AutomaticStringEnumTypeConverter implements TypeConverter<String, Enum> { @Override public String reverse(Enum object, SyntheticField toField, Object toObject, String... tags) throws JTransfoException { if (null == object) { return null; } return object.name(); }  @Override boolean canConvert(Type realToType, Type realDomainType); @Override Enum convert(String object, SyntheticField domainField, Object domainObject, String... tags); @Override String reverse(Enum object, SyntheticField toField, Object toObject, String... tags);  }
@Test public void testReverse() throws Exception { assertThat(enumTypeConverter.reverse(Gender.MALE, stringField, null)).isEqualTo(Gender.MALE.name()); assertThat(enumTypeConverter.reverse(Gender.FEMALE, stringField, null)).isEqualTo(Gender.FEMALE.name()); assertThat(enumTypeConverter.reverse(null, stringField, null)).isNull(); }