/** * Creates a second example of Class_Many_01 with other values. * * @return Returns a new instance of class Class_Many_01 with fields filled with other test * values. * @throws DaoException if an unexpected DAO exception occurs. */ protected ClassMany01 getClassMany01Example2() throws DaoException { // fill attributes with example values ClassMany01 classMany01 = new ClassMany01(); classMany01.setFakeAttr(new Float(725185254.0)); return classMany01; }
/** * Tests the creation of the entity Class_Many_01.<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 testCreateClassMany01() throws DaoException { // fill attributes with example values ClassMany01 classMany01 = getClassMany01Example(); // Execute the tested code classMany01Dao.createClassMany01(classMany01); // Verify result boolean found = false; for (ClassMany01 currentClassMany01 : classMany01Dao.findAllClassMany01s()) { if (currentClassMany01.equals(classMany01)) { found = true; } } Assert.assertTrue("Class_Many_01 not created", found); }
/** * Test the suppression of an entity Class_Many_01.<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 testDeleteClassMany01() throws DaoException { // Initialized the test ClassMany01 classMany01 = getClassMany01Example(); classMany01Dao.createClassMany01(classMany01); // Execute the tested code classMany01Dao.deleteClassMany01(classMany01); // Verify result boolean found = false; for (ClassMany01 currentClassMany01 : classMany01Dao.findAllClassMany01s()) { if (currentClassMany01.getId().equals(classMany01.getId())) { found = true; } } Assert.assertFalse("ClassMany01 not deleted", found); }
/** * Test the modification of an entity Class_Many_01.<br> * * <ul> * <li>Step 1 : Create an entity * <li>Step 2 : Modify the entity * <li>Step 3 : Search the entity and verify the modified values * </ul> * * @throws DaoException if an unexpected DAO exception occurs. */ public final void testUpdateClassMany01() throws DaoException { // Initialized the test ClassMany01 classMany01 = getClassMany01Example(); classMany01Dao.createClassMany01(classMany01); // Execute the tested code classMany01.setFakeAttr(new Float(725185254.0)); classMany01Dao.updateClassMany01(classMany01); // Verify result boolean found = false; for (ClassMany01 currentClassMany01 : classMany01Dao.findAllClassMany01s()) { if (currentClassMany01.equals(classMany01)) { found = true; Assert.assertEquals( "Value fakeAttr not modified", new Float(725185254.0), classMany01.getFakeAttr()); } } Assert.assertTrue("ClassMany01 not found", found); }