@Test public void testCreate() { try { svc.create(testRecipe); } catch (IdAlreadyExistsException e) { System.out.println("Recipe ID already exists"); fail(); } Recipe actual = null; List<Recipe> list = svc.getRecipeList(); for (Recipe recipe : list) { if (recipe.getId() == testRecipe.getId()) { actual = recipe; } assertNotNull(actual); } }