### Question:
RestServiceExceptionFacade implements ExceptionMapper<Throwable> { public void setExposeInternalErrorDetails(boolean exposeInternalErrorDetails) { this.exposeInternalErrorDetails = exposeInternalErrorDetails; if (exposeInternalErrorDetails) { String message = "****** Exposing of internal error details is enabled! This violates OWASP A6 (Sensitive Data Exposure) and shall only be used for testing/debugging and never in production. ******"; LOG.warn(message); System.err.println(message); } } RestServiceExceptionFacade(); @Override Response toResponse(Throwable exception); ObjectMapper getMapper(); @Inject void setMapper(ObjectMapper mapper); void setExposeInternalErrorDetails(boolean exposeInternalErrorDetails); boolean isExposeInternalErrorDetails();  }### Answer:
@Test public void testSecurityExceptionExposed() { RestServiceExceptionFacade exceptionFacade = getExceptionFacade(); exceptionFacade.setExposeInternalErrorDetails(true); String secretMessage = "Secret information not to be revealed on client - only to be logged on server!"; int statusCode = 403; String message = "The operation failed due to security restrictions. Please contact the support in case of a permission problem."; String code = null; checkFacade(exceptionFacade, new AccessDeniedException(secretMessage), statusCode, "SecurityErrorUserException: " + message + System.lineSeparator() + "AccessDeniedException: " + secretMessage, UUID_ANY, code); }
@Test public void testTechnicalCustomRuntimeServerExceptionExposed() { RestServiceExceptionFacade exceptionFacade = getExceptionFacade(); exceptionFacade.setExposeInternalErrorDetails(true); String message = "Internal server error occurred"; IllegalCaseException error = new IllegalCaseException(message); String expectedMessage = "TechnicalErrorUserException: An unexpected error has occurred! We apologize any inconvenience. Please try again later." + System.lineSeparator() + error.getClass().getSimpleName() + ": " + error.getLocalizedMessage(); checkFacade(exceptionFacade, error, 500, expectedMessage, error.getUuid().toString(), CODE_TECHNICAL_ERROR); }