SimpleJsonWriter { String toJsonString() { final String valueString = valueMap.entrySet() .stream() .map(entry -> " " + jsonEscape(entry.getKey()) + ": " + jsonEscape(entry.getValue())) .collect(Collectors.joining(",\n")); return "{\n" + valueString + "\n}"; }  static SimpleJsonWriter of(Map<String, ?> values); @Override String toString();  }
@Test public void itWritesAValidEmptyObject() { assertThat(jsonWriter.toJsonString().replaceAll("\\s", "")).isEqualTo("{}"); }