GsonSerializer implements JsonSerializer { @Override public String toJson(Object object) { return gson.toJson(object); } GsonSerializer(Gson gson); @Override T fromJson(String json, Class<T> targetClass); @Override String toJson(Object object);  }
@Test public void shouldProperlySerializeAnyGivenValue() throws Exception { Integer integer = new Integer(359); String serializedObject = gsonSerializer.toJson(integer); assertThat(serializedObject).isNotNull(); assertThat(serializedObject).isInstanceOf(String.class); assertThat(serializedObject).isEqualTo("359"); }