@Test public void basics() { BaseEntity another = new BaseEntity(); assertNull("id is set.", another.getId()); assertNull("version is set.", another.getVersion()); another.setId(ID); assertNotNull("id is null.", another.getId()); another.setId(null); assertNull("id not cleared.", another.getId()); another.setVersion(VERSION); assertNotNull("version is null.", another.getVersion()); another.setVersion(null); assertNull("version not cleared.", another.getVersion()); }
@Test public void isNew() { assertFalse("entity is new.", entity.isNew()); entity.setVersion(null); assertFalse("entity is new.", entity.isNew()); entity.setId(null); assertTrue("entity not new.", entity.isNew()); entity.setVersion(VERSION); assertTrue("entity not new.", entity.isNew()); }