AWSAuthService { public ResponseEntity<String> configureClient(AWSClientConfiguration awsClientConfiguration, String token){ String jsonStr = JSONUtil.getJSON(awsClientConfiguration); Response response = reqProcessor.process("/auth/aws/config/configureclient",jsonStr, token); if(response.getHttpstatus().equals(HttpStatus.NO_CONTENT)){ return ResponseEntity.status(HttpStatus.OK).body("{\"messages\":[\"AWS Client successfully configured \"]}"); }else{ return ResponseEntity.status(response.getHttpstatus()).body(response.getResponse()); } }  ResponseEntity<String> authenticateEC2(AWSLogin login); ResponseEntity<String> createRole(String token, AWSLoginRole awsLoginRole, UserDetails userDetails); ResponseEntity<String> updateRole(String token, AWSLoginRole awsLoginRole); ResponseEntity<String> deleteRole(String token, String role, UserDetails userDetails); ResponseEntity<String> fetchRole(String token, String role); ResponseEntity<String> listRoles(String token); ResponseEntity<String> configureClient(AWSClientConfiguration awsClientConfiguration, String token); ResponseEntity<String> readClientConfiguration(String token); ResponseEntity<String> createSTSRole(AWSStsRole awsStsRole, String token); ResponseEntity<String> authenticateIAM(AWSIAMLogin awsiamLogin); ResponseEntity<String> authenticate(AWSAuthType authType, AWSAuthLogin awsAuthLogin); Response configureAWSRole(String roleName,String policies,String token );  }
@Test public void test_configureClient_successfully() { String token = "5PDrOhsy4ig8L3EpsJZSLAMg"; AWSClientConfiguration awsClientConfiguration = new AWSClientConfiguration(); awsClientConfiguration.setAccess_key("accesskey"); awsClientConfiguration.setSecret_key("secretKey"); Response response = getMockResponse(HttpStatus.NO_CONTENT, true, ""); String jsonStr = "{ \"access_key\": \"string\", \"secret_key\": \"string\"}"; ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body("{\"messages\":[\"AWS Client successfully configured \"]}"); when(reqProcessor.process("/auth/aws/config/configureclient", jsonStr, token)).thenReturn(response); when(JSONUtil.getJSON(awsClientConfiguration)).thenReturn(jsonStr); ResponseEntity<String> responseEntity = awsAuthService.configureClient(awsClientConfiguration, token); assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); assertEquals(responseEntityExpected, responseEntity); }