Skip to content

Commit

Permalink
Update Feature18Tests.java
Browse files Browse the repository at this point in the history
  • Loading branch information
hashreds committed Dec 6, 2023
1 parent c2fd2e1 commit ed59d68
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/src/test/java/cse/gradle/Feature18Tests.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,39 @@

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();
MockView view = new MockView(new ArrayList<Recipe>());
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<Recipe> 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<Recipe>());
MockController controller = new MockController();
Recipe recipe = new Recipe("eggs, bacon", "cook for 10 minutes", "breakfast", "American breakfast");

assertEquals("html", controller.shareRecipe(recipe));
}
}

0 comments on commit ed59d68

Please sign in to comment.