@Test public void itAddsNewRecipes() { Recipe recipe = new Recipe(); recipe.setName("Spaghetti"); recipe.setInstructions("Make it"); recipeDAO.create(recipe); assertEquals(3, recipeDAO.findAll().size()); }
@Before public void setUp() { Recipe recipe_one = new Recipe(); Recipe recipe_two = new Recipe(); recipe_one.setId((long) 1); recipe_one.setName("Shrimps"); recipe_one.setInstructions("Instructions"); recipe_two.setId((long) 2); recipe_two.setName("Salad"); recipe_two.setInstructions("Instructions"); SessionFactory factory = new Configuration().configure().buildSessionFactory(); Session session = factory.openSession(); Transaction transaction = session.beginTransaction(); session.save(recipe_one); session.save(recipe_two); transaction.commit(); session.close(); }