TypeConversion { public static String convertMapToJsonString(Map<String, String> map) { return gson.toJson(map); }  static com.google.protobuf.Timestamp convertTimestamp(Date ts); static List<String> convertTagStringToList(String tags); static Map<String, String> convertJsonStringToMap(String jsonString); static Map<String, Enum> convertJsonStringToEnumMap(String jsonString); static String convertMapToJsonString(Map<String, String> map); static String convertEnumMapToJsonString(Map<String, Enum> map);  }
@Test public void convertMapToJsonStringShouldReturnJsonStringForGivenMap() { Map<String, String> input = new HashMap<>(); input.put("key", "value"); assertThat( TypeConversion.convertMapToJsonString(input), hasJsonPath("$.key", equalTo("value"))); }
@Test public void convertMapToJsonStringShouldReturnEmptyJsonForAnEmptyMap() { Map<String, String> input = new HashMap<>(); assertThat(TypeConversion.convertMapToJsonString(input), equalTo("{}")); }