@Test public void testCustomTypeAdapter() { serializer = serializer.withTypeAdapter( StringObject.class, new JsonSerializer<StringObject>() { @Override public JsonElement serialize( StringObject strObj, Type type, JsonSerializationContext jsc) { return new JsonPrimitive(strObj.toString() + ", with custom serialization!"); } }); Bond.obs("StringObject", serializer.serialize(new StringObject("foobar"))).spy(); }