Skip to content

Commit

Permalink
Add tests and fix style checks
Browse files Browse the repository at this point in the history
  • Loading branch information
GamerYuan committed Oct 26, 2023
1 parent b414eb8 commit 10bab8b
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/test/java/seedu/address/model/recipe/RecipeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.testutil.TypicalIngredients.EGG;
import static seedu.address.testutil.TypicalIngredients.FLOUR;
import static seedu.address.testutil.TypicalRecipe.COOKIES;
import static seedu.address.testutil.TypicalRecipe.COOKIES_STRING;
import static seedu.address.testutil.TypicalRecipe.SPONGECAKE;
Expand All @@ -15,6 +17,7 @@
import org.junit.jupiter.api.Test;

import seedu.address.model.Name;
import seedu.address.model.ingredient.exceptions.IngredientNotFoundException;

public class RecipeTest {
@Test
Expand Down Expand Up @@ -102,7 +105,26 @@ public void modifyRecipe_nullRecipeInstruction_throwsNullPointerException() {

@Test
public void modifyRecipe_indexGreaterThanAvailableSteps_throwsIllegalArgumentException() {
assertThrows(IllegalArgumentException.class, () -> COOKIES.modifyRecipeStep(7, "Hello"));
assertThrows(IllegalArgumentException.class, () ->
COOKIES.modifyRecipeStep(7, "Hello"));
}

@Test
public void modifyRecipeIngredients_nullIngredient_throwsNullPointerException() {
assertThrows(NullPointerException.class, () ->
COOKIES.modifyIngredients("Flour", null));
}

@Test
public void modifyRecipeIngredients_ingredientNotInList_throwsIngredientNotFoundException() {
assertThrows(IngredientNotFoundException.class, () ->
COOKIES.modifyIngredients("Eggs", FLOUR));
}

@Test
public void modifyRecipeIngredients_ingredientsInList_success() {
Recipe modifiedCookies = COOKIES.modifyIngredients("Flour", EGG);
assertTrue(modifiedCookies.getIngredients().contains(EGG));
}

@Test
Expand Down

0 comments on commit 10bab8b

Please sign in to comment.