ObjectToStringConverter extends AbstractConverter { @Override public boolean canHandle(Object source, TypeToken<?> targetTypeToken) { return (source != null) && targetTypeToken.isSubtypeOf(String.class); } ObjectToStringConverter();  ObjectToStringConverter(int priority); @Override Object convert(Object source, TypeToken<?> targetTypeToken); @Override boolean canHandle(Object source, TypeToken<?> targetTypeToken);  }
@Test public void testCanHandle() { assertTrue(converter.canHandle(new Date(), TypeToken.of(String.class))); assertTrue(converter.canHandle("test", TypeToken.of(String.class))); assertFalse(converter.canHandle(new Date(), TypeToken.of(Date.class))); }