IntegerToEnumTypeMapper implements TypeMapper<Integer, T> { @Override public Type getJavaType(Column column) { requireNonNull(injector, IntegerToEnumTypeMapper.class.getSimpleName() + ".getJavaType(Column) is not available if instantiated " + "without injector." ); return new GeneratedEnumType( EnumGeneratorUtil.enumNameOf(column, injector), EnumGeneratorUtil.enumConstantsOf(column) ); } IntegerToEnumTypeMapper(); @Override String getLabel(); @Override boolean isToolApplicable(); @Override Type getJavaType(Column column); @Override TypeMapper.Category getJavaTypeCategory(Column column); @Override T toJavaType(Column column, Class<?> entityType, Integer value); @Override Integer 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)); }