### Question:
CustomJsonLibHandler implements ContentTypeHandler { public String fromObject(Object obj, String resultCode, Writer stream, String callback) throws IOException { String value = null; if (obj != null) { if (isArray(obj)) { JSONArray jsonArray = JSONArray.fromObject(obj); value = jsonArray.toString(); } else { JSONObject jsonObject = JSONObject.fromObject(obj); value = jsonObject.toString(); } } if (value != null) { if (callback != null) stream.write(callback + "(" + value + ")"); else stream.write(value); } return null; }  @Deprecated @Override void toObject(Reader in, Object target); @Override void toObject(ActionInvocation actionInvocation, Reader in, Object target); String fromObject(Object obj, String resultCode, Writer stream, String callback); @Deprecated @Override String fromObject(Object obj, String resultCode, Writer stream); @Override String fromObject(ActionInvocation actionInvocation, Object obj, String resultCode, Writer stream); String getContentType(); String getExtension();  }### Answer:
@Test public void testFromObject() throws IOException { EntryWithReferencesBean<ArrivalAndDepartureV2Bean> response = new HandlerTestHelper().createTestObject(); Writer writer = new StringWriter(); fromObject(response, "arg1", writer, null); writer.close(); assertEquals(expected, writer.toString()); }