### Question:
OS3Exception extends  Exception { public OS3Exception() { } OS3Exception();  OS3Exception(String codeVal, String messageVal, String requestIdVal,
                      String resourceVal);  OS3Exception(String codeVal, String messageVal, int httpCode); String getCode(); void setCode(String code); String getErrorMessage(); void setErrorMessage(String errorMessage); String getRequestId(); void setRequestId(String requestId); String getResource(); void setResource(String resource); int getHttpCode(); void setHttpCode(int httpCode); String toXml();  }### Answer:
@Test public void testOS3Exception() { OS3Exception ex = new OS3Exception("AccessDenied", "Access Denied", 403); String requestId = OzoneUtils.getRequestID(); ex = S3ErrorTable.newError(ex, "bucket"); ex.setRequestId(requestId); String val = ex.toXml(); String formatString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<Error>\n" + " <Code>%s</Code>\n" + " <Message>%s</Message>\n" + " <Resource>%s</Resource>\n" + " <RequestId>%s</RequestId>\n" + "</Error>\n"; String expected = String.format(formatString, ex.getCode(), ex.getErrorMessage(), ex.getResource(), ex.getRequestId()); Assert.assertEquals(expected, val); }