@Test public void testPersist() { Assert.assertNotNull( "Data on demand for 'ApplicationUser' failed to initialize correctly", dod.getRandomApplicationUser()); ApplicationUser obj = dod.getNewTransientApplicationUser(Integer.MAX_VALUE); Assert.assertNotNull( "Data on demand for 'ApplicationUser' failed to provide a new transient entity", obj); Assert.assertNull("Expected 'ApplicationUser' identifier to be null", obj.getUserID()); obj.persist(); obj.flush(); Assert.assertNotNull( "Expected 'ApplicationUser' identifier to no longer be null", obj.getUserID()); }
@Test public void testFlush() { ApplicationUser obj = dod.getRandomApplicationUser(); Assert.assertNotNull( "Data on demand for 'ApplicationUser' failed to initialize correctly", obj); Integer id = obj.getUserID(); Assert.assertNotNull( "Data on demand for 'ApplicationUser' failed to provide an identifier", id); obj = ApplicationUser.findApplicationUser(id); Assert.assertNotNull( "Find method for 'ApplicationUser' illegally returned null for id '" + id + "'", obj); boolean modified = dod.modifyApplicationUser(obj); Integer currentVersion = obj.getVersion(); obj.flush(); Assert.assertTrue( "Version for 'ApplicationUser' failed to increment on flush directive", (currentVersion != null && obj.getVersion() > currentVersion) || !modified); }
@Test public void testMergeUpdate() { ApplicationUser obj = dod.getRandomApplicationUser(); Assert.assertNotNull( "Data on demand for 'ApplicationUser' failed to initialize correctly", obj); Integer id = obj.getUserID(); Assert.assertNotNull( "Data on demand for 'ApplicationUser' failed to provide an identifier", id); obj = ApplicationUser.findApplicationUser(id); boolean modified = dod.modifyApplicationUser(obj); Integer currentVersion = obj.getVersion(); ApplicationUser merged = obj.merge(); obj.flush(); Assert.assertEquals( "Identifier of merged object not the same as identifier of original object", merged.getUserID(), id); Assert.assertTrue( "Version for 'ApplicationUser' failed to increment on merge and flush directive", (currentVersion != null && obj.getVersion() > currentVersion) || !modified); }