TypeConverterProvider implements ITypeConverterProvider { public <TTargetType> TypeConverterProvider add(ITypeConverter<TTargetType> typeConverter) { Type targetType = typeConverter.getTargetType(); if(typeConverters.containsKey(targetType)) { throw new TypeConverterAlreadyRegisteredException(String.format("TargetType '%s' has already been registered", targetType)); } typeConverters.put(typeConverter.getTargetType(), typeConverter); return this; } TypeConverterProvider(); TypeConverterProvider add(ITypeConverter<TTargetType> typeConverter); ITypeConverter<TTargetType> resolve(Type targetType); TypeConverterProvider override(ITypeConverter<TTargetType> typeConverter); @Override String toString();  }
@Test public void testAdd_Duplicate() throws Exception { JUnitUtils.assertThrows(() -> provider.add(new IntegerConverter()), TypeConverterAlreadyRegisteredException.class); }