StringToEnumTypeMapper implements TypeMapper<String, T> { @Override public Type getJavaType(Column column) { requireNonNull(injector, StringToEnumTypeMapper.class.getSimpleName() + ".getJavaType(Column) is not available if instantiated without injector." ); return new GeneratedEnumType( EnumGeneratorUtil.enumNameOf(column, injector), EnumGeneratorUtil.enumConstantsOf(column) ); } StringToEnumTypeMapper(); @Override String getLabel(); @Override Type getJavaType(Column column); @Override Category getJavaTypeCategory(Column column); @Override T toJavaType(Column column, Class<?> entityType, String value); @Override String toDatabaseType(T constant); @Inject public Injector injector; }
@Test void getJavaType() { final Type type = instance.getJavaType(column); assertTrue(type.getTypeName().toLowerCase().contains(COLUMN_NAME.toLowerCase())); }
@Test void getJavaTypeNull() { assertThrows(NullPointerException.class, () -> instance.getJavaType(null)); }