@Test
public void testCreateUser() {

    HttpServletRequest request = mock(HttpServletRequest.class);
    RevisionInfo revisionInfo = new RevisionInfo("client1", 0L);
    User user = new User(null, "identity");
    user.setRevision(revisionInfo);
    RevisionInfo resultRevisionInfo = new RevisionInfo("client1", 1L);
    User result = new User("identifier", user.getIdentity());
    result.setRevision(resultRevisionInfo);
    when(serviceFacade.createUser(user)).thenReturn(result);
    tenantResource.createUser(request, user);
    verify(serviceFacade).createUser(user);
    verify(eventService).publish(eq(EventFactory.userCreated(result)));
}