UserService { public LoginResponse isValidRemoteLogin(String userName, String password) { String requestURL = configuration.dristhiBaseURL() + AUTHENTICATE_USER_URL_PATH + userName; return httpAgent.urlCanBeAccessWithGivenCredentials(requestURL, userName, password); } UserService(Repository repository, AllSettings allSettings, AllSharedPreferences allSharedPreferences, HTTPAgent httpAgent, Session session,
                       DristhiConfiguration configuration, SaveANMLocationTask saveANMLocationTask); boolean isValidLocalLogin(String userName, String password); LoginResponse isValidRemoteLogin(String userName, String password); void localLogin(String userName, String password); void remoteLogin(String userName, String password, String anmLocation); boolean hasARegisteredUser(); void logout(); void logoutSession(); boolean hasSessionExpired(); String switchLanguagePreference();  }
@Test public void shouldUseHttpAgentToDoRemoteLoginCheck() { when(configuration.dristhiBaseURL()).thenReturn("http: userService.isValidRemoteLogin("userX", "password Y"); verify(httpAgent).urlCanBeAccessWithGivenCredentials("http: }