public static String toJson(Message message) {
    StringWriter json = new StringWriter();
    try (JsonWriter jsonWriter = JsonWriter.of(json)) {
      write(message, jsonWriter);
    }
    return json.toString();
  }
@Test
  public void write_empty_map() {
    TestMap.Builder builder = TestMap.newBuilder();
    assertThat(toJson(builder.build())).isEqualTo("{\"stringMap\":{},\"nestedMap\":{}}");
  }