LoginClient extends SdkHttpClient { public LoginResponse login(LoginRequest credentials) { return buildClient() .target(CLC_API_URL + "/authentication/login") .request().post( entity(credentials, APPLICATION_JSON_TYPE) ) .readEntity(LoginResponse.class); } LoginClient(SdkConfiguration config); LoginResponse login(LoginRequest credentials);  }
@Test public void testLoginWithCorrectCredentials() { Credentials credentials = new DefaultCredentialsProvider().getCredentials(); LoginResponse response = client.login( new LoginRequest(credentials.getUsername(), credentials.getPassword()) ); assert response.getAccountAlias() != null; assert response.getBearerToken() != null; }
@Test(expectedExceptions = ResponseProcessingException.class) public void testLoginWithIncorrectCredentials() { client.login(new LoginRequest("incorrect", "account")); }