### Question:
RequestIdFilter implements ContainerRequestFilter { protected String createRequestError(String requestId, String requestTable) { ObjectMapper mapper = new ObjectMapper(); RequestError error = new RequestError(); ServiceException serviceException = new ServiceException(); serviceException.setMessageId(ErrorNumbers.SVC_BAD_PARAMETER); serviceException .setText("RequestId: " + requestId + " already exists in the RequestDB " + requestTable + " table"); error.setServiceException(serviceException); String errorMessage = null; try { errorMessage = mapper.writeValueAsString(error); } catch (JsonProcessingException e) { return "Unable to write requestError to String when requestId already exists in the RequestDb due to error: " + e.getMessage(); } return errorMessage; }  @Override void filter(ContainerRequestContext context);  }### Answer:
@Test public void createRequestErrorTest() throws IOException { RequestError requestError = getRequestError(); String result = requestIdFilter.createRequestError(REQUEST_ID, "InfraActiveRequests"); RequestError resultingError = mapper.readValue(result, RequestError.class); assertThat(resultingError, sameBeanAs(requestError)); }