@Test public void testNestedSorting() { Set<String> stringHashSet = Sets.newHashSet("b", "a", "z", "g"); Map<String, String> stringHashMap = new HashMap<>(); stringHashMap.put("b", "bar"); stringHashMap.put("a", "foo"); stringHashMap.put("z", "baz"); stringHashMap.put("g", "test"); NestingObject no = new NestingObject(); no.stringMap = stringHashMap; no.stringSet = stringHashSet; Map<String, Object> objectMap = new HashMap<>(); objectMap.put("nestingObject", no); objectMap.put("hashSet", stringHashSet); objectMap.put("hashMap", stringHashMap); Set<Object> objectSet = Sets.newHashSet(stringHashSet, stringHashMap, no); Bond.obs("objectMap", serializer.serialize(objectMap)) .obs("objectSet", serializer.serialize(objectSet)).spy(); }
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);  }