@Test public void testSetSorting() { Set<String> stringHashSet = Sets.newHashSet("b", "a", "z", "g"); Set<StringObject> stringObjectHashSet = Sets.newHashSet(new StringObject("b"), new StringObject("a"), new StringObject("z"), new StringObject("g")); Bond.obs("stringHashSet", serializer.serialize(stringHashSet)) .obs("stringObjectHashSet", serializer.serialize(stringObjectHashSet)) .spy("hash sets"); Set<String> stringOnlyTreeSet = new TreeSet<>(REVERSE_SORT_COMPARATOR); stringOnlyTreeSet.add("b"); stringOnlyTreeSet.add("a"); stringOnlyTreeSet.add("z"); stringOnlyTreeSet.add("g"); Bond.obs("stringOnlyTreeSet", serializer.serialize(stringOnlyTreeSet)).spy("tree sets"); }
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);  }