I am using JUnit, Hibernate and Spring Framework. I wrote a simple test to test whether entity was updated correctly or not.
Is this correct way to test if entity was updated? Could it be done better?
@Test
public void testUpdated(){
ConfirmationEntity confirmationEntity = confirmationDao.find(1L);
confirmationEntity.setConfirmationString("0123456789");
confirmationEntity.setConfirmationStringValidUntil(new LocalDateTime());
confirmationDao.update(confirmationEntity);
ConfirmationEntity confirmationEntityUpdated = confirmationDao.find(1L);
Assert.assertSame(
"Expected values to be the same.",
confirmationEntity,
confirmationEntityUpdated
);
}