@Test
public void testOnUserCreatedEventAnUserViewIsSaved() {

    UserId expectedUserId = new UserId();
    String expectedName = "name";
    String expectedUserName = "userName";
    UserCreatedEvent testEvent = new UserCreatedEvent(expectedUserId, expectedName, expectedUserName, "password");
    testSubject.on(testEvent);
    ArgumentCaptor<UserView> userViewCaptor = ArgumentCaptor.forClass(UserView.class);
    verify(userViewRepository).save(userViewCaptor.capture());
    UserView result = userViewCaptor.getValue();
    assertNotNull(result);
    assertEquals(expectedUserId.getIdentifier(), result.getUserId());
    assertEquals(expectedName, result.getName());
    assertEquals(expectedUserName, result.getUserName());
}