DBEnumMapper { public T getEnum(String value) { if (value == null) return null; T enumValue = mappings.get(value); if (enumValue == null) throw new Error(format("can not parse value to enum, enumClass={}, value={}", enumClass.getCanonicalName(), value)); return enumValue; } DBEnumMapper(Class<T> enumClass); T getEnum(String value);  }
@Test void getEnum() { assertThat(mapper.getEnum(null)).isNull(); assertThat(mapper.getEnum("DB_V1")).isEqualTo(TestEnum.V1); assertThat(mapper.getEnum("DB_V2")).isEqualTo(TestEnum.V2); }