@Test public void testMapSorting() { Map<String, String> stringOnlyHashMap = new HashMap<>(); stringOnlyHashMap.put("b", "bar"); stringOnlyHashMap.put("a", "foo"); stringOnlyHashMap.put("z", "baz"); stringOnlyHashMap.put("g", "test"); Map<StringObject, String> stringObjectHashMap = new HashMap<>(); stringObjectHashMap.put(new StringObject("b"), "bar"); stringObjectHashMap.put(new StringObject("a"), "foo"); stringObjectHashMap.put(new StringObject("z"), "baz"); stringObjectHashMap.put(new StringObject("g"), "test"); Bond.obs("stringOnlyHashMap", serializer.serialize(stringOnlyHashMap)) .obs("stringObjectHashMap", serializer.serialize(stringObjectHashMap)) .spy("hash maps"); Map<String, String> stringOnlyTreeMap = new TreeMap<>(REVERSE_SORT_COMPARATOR); stringOnlyTreeMap.put("b", "bar"); stringOnlyTreeMap.put("a", "foo"); stringOnlyTreeMap.put("z", "baz"); stringOnlyTreeMap.put("g", "test"); Bond.obs("stringOnlyTreeMap", serializer.serialize(stringOnlyTreeMap)).spy("tree maps"); }
String serialize(Object obj) { return gson.toJson(obj); }
Serializer { String serialize(Object obj) { return gson.toJson(obj); } }
Serializer { String serialize(Object obj) { return gson.toJson(obj); }  }
Serializer { String serialize(Object obj) { return gson.toJson(obj); }  Serializer withToStringSerialization(Class<T> clazz); Serializer withDoublePrecision(final int places); Serializer withFloatPrecision(final int places); Serializer withTypeAdapter(Type type, Object typeAdapter); Serializer withTypeHierarchyAdapter(Class<?> baseType, Object typeAdapter); }
Serializer { String serialize(Object obj) { return gson.toJson(obj); }  Serializer withToStringSerialization(Class<T> clazz); Serializer withDoublePrecision(final int places); Serializer withFloatPrecision(final int places); Serializer withTypeAdapter(Type type, Object typeAdapter); Serializer withTypeHierarchyAdapter(Class<?> baseType, Object typeAdapter);  }