AccessService { public ResponseEntity<String> listAllPolices(String token){ log.debug(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER).toString()). put(LogMessage.ACTION, "List Policies"). put(LogMessage.MESSAGE, "Trying to get all policies"). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL).toString()). build())); Response response = reqProcessor.process("/access/list","{}",token); return ResponseEntity.status(response.getHttpstatus()).body(response.getResponse()); }  ResponseEntity<String> createPolicy(String token, AccessPolicy accessPolicy); ResponseEntity<String> updatePolicy( String token,  AccessPolicy accessPolicy); ResponseEntity<String> listAllPolices(String token); ResponseEntity<String> getPolicyInfo(String token, String accessid); ResponseEntity<String> deletePolicyInfo(String token, String accessid);  }
@Test public void test_listAllAccessPolicy_successfully() { String token = "5PDrOhsy4ig8L3EpsJZSLAMg"; String responseJson = "{\"policies\":[\"test-access-policy\"]}"; Response response =getMockResponse(HttpStatus.OK, true, responseJson); ResponseEntity<String> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body(responseJson); when(reqProcessor.process("/access/list","{}",token)).thenReturn(response); ResponseEntity<String> responseEntity = accessService.listAllPolices(token); assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); assertEquals(responseEntityExpected, responseEntity); }