### Question:
JsonMapObjectReaderWriter { public String toJson(JsonMapObject obj) { return toJson(obj.asMap()); } JsonMapObjectReaderWriter();  JsonMapObjectReaderWriter(boolean format); String toJson(JsonMapObject obj); String toJson(Map<String, Object> map); String toJson(List<Object> list); void toJson(JsonMapObject obj, OutputStream os); void toJson(Map<String, Object> map, OutputStream os); JsonMapObject fromJsonToJsonObject(InputStream is); JsonMapObject fromJsonToJsonObject(String json); void fromJson(JsonMapObject obj, String json); Map<String, Object> fromJson(InputStream is); Map<String, Object> fromJson(String json); List<Object> fromJsonAsList(String json); List<Object> fromJsonAsList(String name, String json); void setFormat(boolean format);  }### Answer:
@Test public void testWriteMap() throws Exception { Map<String, Object> map = new LinkedHashMap<>(); map.put("a", "aValue"); map.put("b", 123); map.put("c", Collections.singletonList("cValue")); map.put("claim", null); String json = new JsonMapObjectReaderWriter().toJson(map); assertEquals("{\"a\":\"aValue\",\"b\":123,\"c\":[\"cValue\"],\"claim\":null}", json); }
@Test public void testWriteDateProperty() throws Exception { Date date = new Date(); Map<String, Object> map = Collections.singletonMap("createdAt", date); String json = new JsonMapObjectReaderWriter().toJson(map); assertEquals("{\"createdAt\":\"" + date.toString() + "\"}", json); }