### Question:
PrincipalProvider extends AuditProvider { @Override public void preUpdate(Object entity) { updatePrincipal(entity, false); }  @Override void prePersist(Object entity); @Override void preUpdate(Object entity);  }### Answer:
@Test public void should_set_users_for_update() { String changer = "changer"; MockPrincipalProvider provider = new MockPrincipalProvider(changer); AuditedEntity entity = new AuditedEntity(); provider.preUpdate(entity); assertNotNull(entity.getChanger()); assertNotNull(entity.getChangerOnly()); assertNotNull(entity.getChangerOnlyPrincipal()); assertEquals(entity.getChanger(), changer); assertEquals(entity.getChangerOnly(), changer); assertEquals(entity.getChangerOnlyPrincipal().getName(), changer); assertNull(entity.getCreator()); assertNull(entity.getCreatorPrincipal()); }