+ assertEquals(POLICY_DATA, gson.toJson(returnedResp.getBody()));
+ }
+
+ private String urlPutPolicy() {
+ return "/v2/policies/";
+ }
+
+ private void whenPutReturnOK(String url, String putBody, HttpStatus status, String body) {
+ ResponseEntity<String> ret = new ResponseEntity<>(body, status);
+ when(restClient.putForEntity(eq(url), eq(putBody))).thenReturn(Mono.just(ret));
+ }
+
+ private void whenPutReturnFailure(String url, String putBody, HttpStatus status, String body) {
+ HttpServerErrorException e =
+ new HttpServerErrorException(status, body, body.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
+ when(restClient.putForEntity(eq(url), eq(putBody))).thenReturn(Mono.error(e));