### Question:
FileError extends AbstractReport { @Override public void print(PrintStream out, StringBuilder ret , int level, boolean first) { ret.setLength(0); out.print(addLevel(ret, level).append('{')); out.print(toJsonString(ret, level+1, "code", code, true)); out.print(toJsonString(ret, level+1, "description", description, false)); ret.setLength(0); out.print(addLevel(ret.append('\n'), level).append('}')); }  JSONObject toJson(); @Override void print(PrintStream out, StringBuilder ret , int level, boolean first);  }### Answer:
@Test(groups = { "JsonGeneration" }, description = "Json generated" ,priority=105 ) public void verifyJsonGeneration() throws Exception { FileError fileError = new FileError(FILE_ERROR_CODE.FILE_NOT_FOUND, "file_error1"); ByteArrayOutputStream oStream = new ByteArrayOutputStream(); PrintStream stream = new PrintStream(oStream); fileError.print(stream, new StringBuilder(), 1, true); String text = oStream.toString(); JSONObject res = new JSONObject(text); Assert.assertEquals(res.getString("code"), "FILE_NOT_FOUND", "wrong file error code"); Assert.assertEquals(res.getString("description"), "file_error1", "wrong file error description"); }