/** * Tests the creation of the entity B.<br> * * <ul> * <li>Step 1 : Create an entity * <li>Step 2 : Search the entity and verify it exists * </ul> * * @throws DaoException if an unexpected DAO exception occurs. */ public final void testCreateB() throws DaoException { // fill attributes with example values B b = getBExample(); // Execute the tested code assobidimanytomanyDao.createB(b); // Verify result boolean found = false; for (B currentB : assobidimanytomanyDao.findAllBs()) { if (currentB.equals(b)) { found = true; } } Assert.assertTrue("B not created", found); }
/** * Test the suppression of an entity B.<br> * * <ul> * <li>Step 1 : Create an entity * <li>Step 2 : Delete the entity * <li>Step 3 : Search the entity and verify it doesn't exist anymore * </ul> * * @throws DaoException if an unexpected DAO exception occurs. */ public final void testDeleteB() throws DaoException { // Initialized the test B b = getBExample(); assobidimanytomanyDao.createB(b); // Execute the tested code assobidimanytomanyDao.deleteB(b); // Verify result boolean found = false; for (B currentB : assobidimanytomanyDao.findAllBs()) { if (currentB.getId().equals(b.getId())) { found = true; } } Assert.assertFalse("B not deleted", found); }