AuthApiClient extends BaseApiClient { public Response<AuthenticationContext> authenticate(String userIdentifier, String userSecret) throws SmartlingApiException { final HttpPost httpPost = createJsonPostRequest( getApiUrl(AUTH_API_V2_AUTHENTICATE, baseUrl), new AuthenticationCommand(userIdentifier, userSecret) ); final StringResponse response = executeRequest(httpPost); return getApiV2Response(response.getContents(), new TypeToken<ApiV2ResponseWrapper<AuthenticationContext>>() {}); } AuthApiClient();  AuthApiClient(final ProxyConfiguration proxyConfiguration);  AuthApiClient(final String baseUrl);  AuthApiClient(final ProxyConfiguration proxyConfiguration, final String baseUrl);  AuthApiClient(final ProxyConfiguration proxyConfiguration, final HttpClientConfiguration httpClientConfiguration, final String baseUrl); Response<AuthenticationContext> authenticate(String userIdentifier, String userSecret); Response<AuthenticationContext> refresh(String refreshKey);  }
@Test public void testAuthenticate() throws Exception { when(response.getContents()).thenReturn(AUTH_RESPONSE); Response<AuthenticationContext> response = authApiClient.authenticate(USER_ID, USER_SECRET); HttpRequestBase request = requestCaptor.getValue(); assertEquals(HttpPost.class, request.getClass()); assertEquals("https: assertEquals(ResponseCode.SUCCESS, response.getCode()); assertEquals("eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI1MTFlODBlNy00ZTMxLTQwNWUtYWExMy0zZTY5YjQ4NmVmYzkiLCJleHAiOjE0NDc4NjYwMDksIm5iZiI6MCwiaWF0IjoxNDQ3ODY1NzA5LCJpc3MiOiJodHRwczovL3Nzby5zbWFydGxpbmcuY29tL2F1dGgvcmVhbG1zL1NtYXJ0bGluZyIsImF1ZCI6ImF1dGhlbnRpY2F0aW9uLXNlcnZpY2UiLCJzdWIiOiI5ZDY3ZmI5Yy00ZjIwLTQ1N2ItOTlmZC04MDg4OThjMzA0M2UiLCJhenAiOiJhdXRoZW50aWNhdGlvbi1zZXJ2aWNlIiwic2Vzc2lvbl9zdGF0ZSI6IjFkZDIwMjZiLTgyYzgtNGNlMy05NjUxLTY2NDZmOGY2MmJiZCIsImNsaWVudF9zZXNzaW9uI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