@Test
 public void shouldFindUserByEmailAndPassword() {
   when(userRepository.findUserByEmailAndPassword(Matchers.anyString(), Matchers.anyString()))
       .thenReturn(new User());
   User user = service.findUserByEmailAndPassword("", "");
   verify(userRepository, times(1))
       .findUserByEmailAndPassword(Matchers.anyString(), Matchers.anyString());
 }
  @Test
  public void shouldNotGetAuthenticatedUserProfile() {

    when(authenticatedUserService.getAuthenticatedUser()).thenReturn(null);
    when(userRepository.findOne(Matchers.anyInt())).thenReturn(new User());

    service.getAuthenticatedUserProfile();

    verify(authenticatedUserService, times(1)).getAuthenticatedUser();
    verify(userRepository, times(0)).findOne(Matchers.anyInt());
  }
  @Test
  public void shouldGetAuthenticatedUserProfile() {
    User user = new User();
    user.setId(0);
    AuthenticatedUser authUser = new AuthenticatedUser(user);

    when(authenticatedUserService.getAuthenticatedUser()).thenReturn(authUser);
    when(userRepository.findOne(Matchers.anyInt())).thenReturn(new User());

    service.getAuthenticatedUserProfile();

    verify(authenticatedUserService, times(1)).getAuthenticatedUser();
    verify(userRepository, times(1)).findOne(Matchers.anyInt());
  }
  @Test
  public void shouldGetAllConnections() {
    User user = new User();
    user.setId(0);
    AuthenticatedUser authUser = new AuthenticatedUser(user);
    when(authenticatedUserService.getAuthenticatedUser()).thenReturn(authUser);
    when(userRepository.findAllConnectedUsers(Matchers.any(User.class)))
        .thenReturn(new ArrayList<User>());

    service.getAllConnections();

    verify(authenticatedUserService, times(1)).getAuthenticatedUser();
    verify(userRepository, times(1)).findAllConnectedUsers(Matchers.any(User.class));
  }
 @Test
 public void shouldGetAllUsersAndTheirConnections() {
   when(userRepository.findAllUsersAndTheirConnections()).thenReturn(new ArrayList<User>());
   service.getAllUsersAndTheirConnections();
   verify(userRepository, times(1)).findAllUsersAndTheirConnections();
 }