@Test public void testApiCall() throws RemoteApiException { Token token = new Token(); token.setName("sessionToken"); token.setToken("480d9f271e54d02ea8351"); doReturn(token).when(apiClient).doPost(eq(PATH), anyMap(), anyMap(), isNull(), eq(Token.class)); Token result = authenticationApiClient.authenticate(MOCK_USER); assertEquals(token.getName(), result.getName()); assertEquals(token.getToken(), result.getToken()); assertEquals(token, result); }
public Token authenticate(String userId) throws RemoteApiException { String path = "/v1/authenticate"; Map<String, String> headerParams = new HashMap<>(); headerParams.put("userSession", userId); Map<String, String> queryParams = new HashMap<>(); return apiClient.doPost(path, headerParams, queryParams, null, Token.class); }
AuthenticationApiClient { public Token authenticate(String userId) throws RemoteApiException { String path = "/v1/authenticate"; Map<String, String> headerParams = new HashMap<>(); headerParams.put("userSession", userId); Map<String, String> queryParams = new HashMap<>(); return apiClient.doPost(path, headerParams, queryParams, null, Token.class); } }
AuthenticationApiClient { public Token authenticate(String userId) throws RemoteApiException { String path = "/v1/authenticate"; Map<String, String> headerParams = new HashMap<>(); headerParams.put("userSession", userId); Map<String, String> queryParams = new HashMap<>(); return apiClient.doPost(path, headerParams, queryParams, null, Token.class); } AuthenticationApiClient(HttpApiClient apiClient); }
AuthenticationApiClient { public Token authenticate(String userId) throws RemoteApiException { String path = "/v1/authenticate"; Map<String, String> headerParams = new HashMap<>(); headerParams.put("userSession", userId); Map<String, String> queryParams = new HashMap<>(); return apiClient.doPost(path, headerParams, queryParams, null, Token.class); } AuthenticationApiClient(HttpApiClient apiClient); Token authenticate(String userId); }
AuthenticationApiClient { public Token authenticate(String userId) throws RemoteApiException { String path = "/v1/authenticate"; Map<String, String> headerParams = new HashMap<>(); headerParams.put("userSession", userId); Map<String, String> queryParams = new HashMap<>(); return apiClient.doPost(path, headerParams, queryParams, null, Token.class); } AuthenticationApiClient(HttpApiClient apiClient); Token authenticate(String userId);  }