SyncUnverifiedDataAsyncTask extends SynchronisationAsyncTask<T> { private JSONObject login() throws IOException, JSONException { HttpResponse response = loginService.login(applicationContext, currentUser.getUserName(), currentUser.getUnauthenticatedPassword(), currentUser.getServerUrl()); if(response !=null && (response.getStatusLine().getStatusCode() == HttpStatus.SC_CREATED || response.getStatusLine().getStatusCode() == HttpStatus.SC_OK)) return new JSONObject(getResponse(response)); return null; } @Inject  SyncUnverifiedDataAsyncTask(FormService formService,
                                       SyncService<T> recordService,
                                       Repository<T> repository,
                                       LoginService loginService,
                                       RegisterUserService registerUserService,
                                       User user); @Override void setContext(RapidFtrActivity context);  }
@Test public void shouldLoginUser() throws Exception { task.onPreExecute(); task.execute(); verify(loginService).login(applicationContext, "username", "password", "serverUrl"); }