### Question:
RestData implements LlamaAMListener,
    ClientNotificationService.Listener { @SuppressWarnings("unchecked") void writeAsJson(String payloadType, Object obj, Writer out) throws IOException, NotFoundException { if (obj != null) { Map map = new LinkedHashMap(); map.put(REST_VERSION_KEY, REST_VERSION_VALUE); map.put(payloadType, obj); jsonMapper.defaultPrettyPrintingWriter().writeValue(out, map); } else { throw new NotFoundException(); } } RestData(LlamaAMServer llamaAMServer); void onRegister(ClientInfo clientInfo); void onUnregister(ClientInfo clientInfo); @Override void onEvent(LlamaAMEvent event); @SuppressWarnings("unchecked") void writeSummaryAsJson(Writer out); @SuppressWarnings("unchecked") void writeAllAsJson(Writer out); void writeReservationAsJson(UUID reservationId, Writer out); @SuppressWarnings("unchecked") void writeHandleReservationsAsJson(UUID handle, Writer out); void writeQueueReservationsAsJson(String queue, Writer out); void writeNodeResourcesAsJson(String node, Writer out); static final String REST_VERSION_KEY; static final String REST_VERSION_VALUE; }### Answer:
@Test public void testEmptyBean() throws Exception { RestData restData = new RestData(null); StringWriter writer = new StringWriter(); EmptyBean obj = new EmptyBean(); restData.writeAsJson("Test", obj, writer); writer.close(); }