diff --git a/app/src/test/java/cse/gradle/Feature18Tests.java b/app/src/test/java/cse/gradle/Feature18Tests.java index 186e04e..24b4f95 100644 --- a/app/src/test/java/cse/gradle/Feature18Tests.java +++ b/app/src/test/java/cse/gradle/Feature18Tests.java @@ -12,9 +12,11 @@ import static org.junit.jupiter.api.Assertions.*; import java.util.ArrayList; +import java.util.List; class Feature18Tests { + // unit @Test void checkShare() { MockModel model = new MockModel(); @@ -22,6 +24,27 @@ void checkShare() { MockController controller = new MockController(); Recipe recipe = new Recipe("eggs, bacon", "cook for 10 minutes", "breakfast", "American breakfast"); + assertEquals("html", controller.shareRecipe(recipe)); + } + // BDD + @Test + void checkShareWithUser() { + Recipe r1 = new Recipe("eggs, bacon", "cook for 10 minutes", "breakfast", "American breakfast"); + Recipe r2 = new Recipe("salmon, salad", "cook for 20 minutes", "breakfast", "Healthy Lunch"); + Recipe r3 = new Recipe("potatoes", "boil the potatoes", "dinner", "boiled potatoes"); + Recipe r4 = new Recipe("salmon", "boil the salmon", "dinner", "boiled salmon"); + List rList = new ArrayList<>(); + rList.add(r1); + rList.add(r2); + rList.add(r3); + rList.add(r4); + MockModel model = new MockModel(); + User Joe = new User("abc", "123"); + Joe.setRecipeList(rList); + MockView view = new MockView(new ArrayList()); + MockController controller = new MockController(); + Recipe recipe = new Recipe("eggs, bacon", "cook for 10 minutes", "breakfast", "American breakfast"); + assertEquals("html", controller.shareRecipe(recipe)); } }