StringToEnumConverter extends AbstractConverter { @Override public boolean canHandle(Object source, TypeToken<?> targetTypeToken) { Class enumClass = targetTypeToken.getRawType(); return (source instanceof String) && enumClass.isEnum(); }  @SuppressWarnings("unchecked") @Override Object convert(Object source, TypeToken<?> targetTypeToken); @Override boolean canHandle(Object source, TypeToken<?> targetTypeToken);  }
@Test public void testCanHandle() { assertTrue(converter.canHandle("CONVERTER", TypeToken.of(TestEnum.class))); }