@Test public void should_set_users_for_creation() { String creator = "creator"; MockPrincipalProvider provider = new MockPrincipalProvider(creator); AuditedEntity entity = new AuditedEntity(); provider.prePersist(entity); assertNotNull(entity.getCreator()); assertNotNull(entity.getCreatorPrincipal()); assertNotNull(entity.getChanger()); assertEquals(entity.getCreator(), creator); assertEquals(entity.getCreatorPrincipal().getName(), creator); assertEquals(entity.getChanger(), creator); assertNull(entity.getChangerOnly()); assertNull(entity.getChangerOnlyPrincipal()); }
@Override public void prePersist(Object entity) { updatePrincipal(entity, true); }
PrincipalProvider extends AuditProvider { @Override public void prePersist(Object entity) { updatePrincipal(entity, true); } }
PrincipalProvider extends AuditProvider { @Override public void prePersist(Object entity) { updatePrincipal(entity, true); }  }
PrincipalProvider extends AuditProvider { @Override public void prePersist(Object entity) { updatePrincipal(entity, true); }  @Override void prePersist(Object entity); @Override void preUpdate(Object entity); }
PrincipalProvider extends AuditProvider { @Override public void prePersist(Object entity) { updatePrincipal(entity, true); }  @Override void prePersist(Object entity); @Override void preUpdate(Object entity);  }