### Question:
LinkkiConverterRegistry implements Serializable { @SuppressWarnings("unchecked") public <P, M> Converter<P, M> findConverter(Type presentationType, Type modelType) { Class<?> rawPresentationType = getRawType(presentationType); Class<?> rawModelType = getRawType(modelType); if (isIdentityNecessary(rawPresentationType, rawModelType)) { return (Converter<P, M>)Converter.identity(); } else { return converters.computeIfAbsent(rawPresentationType, t -> Sequence.empty()) .stream() .map(Converter.class::cast) .filter(c -> TypeUtils.equals(getPresentationType(c), rawPresentationType) && TypeUtils.equals(rawModelType, getModelType(c))) .findFirst() .orElseThrow(() -> new IllegalArgumentException( "Cannot convert presentation type " + rawPresentationType + " to model type " + rawModelType)); } } @SafeVarargs  LinkkiConverterRegistry(Converter<?, ?>... customConverters);  LinkkiConverterRegistry(Collection<Converter<?, ?>> customConverters);  LinkkiConverterRegistry(Sequence<Converter<?, ?>> customConverters); @SuppressWarnings("unchecked") Converter<P, M> findConverter(Type presentationType, Type modelType); LinkkiConverterRegistry with(Converter<?, ?> converter); static LinkkiConverterRegistry getCurrent(); static final LinkkiConverterRegistry DEFAULT; }### Answer:
@Test public void testFindConverter_Default() { LinkkiConverterRegistry linkkiConverterRegistry = new LinkkiConverterRegistry(); assertThat(linkkiConverterRegistry.findConverter(String.class, Date.class), is(instanceOf(StringToDateConverter.class))); }
@Test public void testFindConverter_NotFound() { Assertions.assertThrows(IllegalArgumentException.class, () -> { new LinkkiConverterRegistry().findConverter(String.class, java.time.LocalDate.class); }); }
@Test public void testFindConverter_overrideDefault() { LinkkiConverterRegistry linkkiConverterRegistry = new LinkkiConverterRegistry(new MyStringToDateConverter()); assertThat(linkkiConverterRegistry.findConverter(String.class, Date.class), is(instanceOf(MyStringToDateConverter.class))); }