aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java')
-rw-r--r--ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java40
1 files changed, 28 insertions, 12 deletions
diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java
index f3cbc23..2a3c8ee 100644
--- a/ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java
+++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java
@@ -40,14 +40,16 @@ public class CupboardServiceTest {
double maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.addNeed(any())).thenReturn(need);
when(mockCupboardDAO.getNeeds()).thenReturn(new Need[0]);
// Invoke
- Need response = cupboardService.createNeed(name, location, maxGoal, type, urgent);
+ Need response = cupboardService.createNeed(name, location, image, maxGoal, type, urgent, description);
// Analyze
assertNotNull(response);
@@ -62,7 +64,9 @@ public class CupboardServiceTest {
double maxGoal = -100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.addNeed(any())).thenReturn(need);
@@ -73,7 +77,7 @@ public class CupboardServiceTest {
// Analyze
assertThrows(IllegalArgumentException.class, () ->
- cupboardService.createNeed(name, location, maxGoal, type, urgent));
+ cupboardService.createNeed(name, location, image, maxGoal, type, urgent, description));
}
@Test
@@ -84,7 +88,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
Need[] needs = { need };
// When the same id is passed in, our mock User DAO will return the User object
@@ -96,7 +102,7 @@ public class CupboardServiceTest {
// Analyze
assertThrows(DuplicateKeyException.class, () ->
- cupboardService.createNeed(name, location, maxGoal, type, urgent));
+ cupboardService.createNeed(name, location, image, maxGoal, type, urgent, description));
}
@Test
@@ -107,7 +113,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
Need[] needs = { need };
// When the same id is passed in, our mock User DAO will return the User object
@@ -129,7 +137,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
Need[] needs = { need };
// When the same id is passed in, our mock User DAO will return the User object
@@ -150,7 +160,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.getNeed(0)).thenReturn(need);
@@ -170,8 +182,10 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- Need need = new Need(name, location, maxGoal, type, urgent);
- Need newNeed = new Need("Octopus", location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
+ Need newNeed = new Need("Octopus", image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.updateNeed(any())).thenReturn(newNeed);
@@ -191,7 +205,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- Need need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.deleteNeed(0)).thenReturn(true);