### Question:
TimestampsProvider extends AuditProvider { @Override public void prePersist(Object entity) { updateTimestamps(entity, true); }  @Override void prePersist(Object entity); @Override void preUpdate(Object entity);  }### Answer:
@Test public void should_set_dates_for_creation() { AuditedEntity entity = new AuditedEntity(); new TimestampsProvider().prePersist(entity); assertNotNull(entity.getCreated()); assertNotNull(entity.getModified()); assertNull(entity.getGregorianModified()); assertNull(entity.getTimestamp()); }
@Test(expected = AuditPropertyException.class) public void should_fail_on_invalid_entity() { InvalidEntity entity = new InvalidEntity(); new TimestampsProvider().prePersist(entity); fail(); }