JsonConverter { public static <T> String objectToJsonBlob(@NonNull T object) { String jsonBlob = null; try { jsonBlob = mapper.writeValueAsString(object); } catch (Exception e) { LOG.error("Exception in writing json blob from object {}", object, e); } return jsonBlob; }  static T jsonBlobToObject(@NonNull String jsonBlob, @NonNull Class<T> clazz); static String objectToJsonBlob(@NonNull T object);  }
@Test public void parseRegionObjToJson() { String regionExpected = "{\"realmKey\":\"RTC\",\"realmDomainComponent\":\"oraclecloud-foobar.com\",\"regionKey\":\"gty\",\"regionIdentifier\":\"us-gty-1\"}"; RegionSchema regionSchema = new RegionSchema("RTC", "oraclecloud-foobar.com", "gty", "us-gty-1"); String regionBlob = JsonConverter.objectToJsonBlob(regionSchema); assertThat(regionExpected, is(regionBlob)); }