getUnit() tests
This commit is contained in:
parent
397bbedd9f
commit
87f8a883d5
1 changed files with 61 additions and 1 deletions
|
|
@ -1,4 +1,64 @@
|
||||||
package commons;
|
package commons;
|
||||||
//should i do it or wait for lines for next week
|
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
|
||||||
public class RecipeIngredientTest {
|
public class RecipeIngredientTest {
|
||||||
|
|
||||||
|
private Recipe recipe;
|
||||||
|
private Ingredient ingredient;
|
||||||
|
private RecipeIngredient recipeIngredient;
|
||||||
|
private RecipeIngredient testIngredient;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setup(){
|
||||||
|
recipe = new Recipe();
|
||||||
|
ingredient = new Ingredient();
|
||||||
|
testIngredient = new RecipeIngredient(recipe,ingredient,1,"KILOGRAM");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getFormalUnitTest(){
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"GRAM");
|
||||||
|
assertEquals(Unit.GRAM, recipeIngredient.getUnit());
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"KILOGRAM");
|
||||||
|
assertEquals(Unit.KILOGRAM, recipeIngredient.getUnit());
|
||||||
|
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"MILLILITER");
|
||||||
|
assertEquals(Unit.MILLILITER, recipeIngredient.getUnit());
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"LITER");
|
||||||
|
assertEquals(Unit.LITER, recipeIngredient.getUnit());
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"TEASPOON");
|
||||||
|
assertEquals(Unit.TEASPOON, recipeIngredient.getUnit());
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"TABLESPOON");
|
||||||
|
assertEquals(Unit.TABLESPOON, recipeIngredient.getUnit());
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"CUP");
|
||||||
|
assertEquals(Unit.CUP, recipeIngredient.getUnit());
|
||||||
|
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"PIECE");
|
||||||
|
assertEquals(Unit.PIECE, recipeIngredient.getUnit());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getInformalUnitTest(){
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"PINCH");
|
||||||
|
assertEquals(Unit.PINCH, recipeIngredient.getUnit());
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"HANDFUL");
|
||||||
|
assertEquals(Unit.HANDFUL, recipeIngredient.getUnit());
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"TO_TASTE");
|
||||||
|
assertEquals(Unit.TO_TASTE, recipeIngredient.getUnit());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void getUnknownUnitTest(){
|
||||||
|
recipeIngredient = new RecipeIngredient(recipe,ingredient,1,"RANDOM");
|
||||||
|
assertNull(recipeIngredient.getUnit());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue