@Test public void testRemoveSide() { Recipe side = new Recipe(2, 1, "Test Side", 4, 100, true, null, "", null); testRecipe.addSide(side); addTestRecipe(); svc.removeSide(testRecipe, side); Recipe actual = null; List<Recipe> list = svc.getRecipeList(); for (Recipe recipe : list) { if (recipe.getId() == testRecipe.getId()) { actual = recipe; break; } } assertEquals(0, actual.getSides().size()); testRecipe.setSides(null); }
@Test public void testAddSide() { addTestRecipe(); Recipe side = new Recipe(2, 1, "Test Side", 4, 100, true, null, "", null); List<Recipe> list = svc.getRecipeList(); svc.addSide(testRecipe, side); testRecipe.addSide(side); int actual = 0; list = svc.getRecipeList(); for (Recipe recipe : list) { if (recipe.getId() == testRecipe.getId()) { actual = recipe.getSides().get(0); break; } } assertEquals(side.getId(), actual); testRecipe.setSides(null); }