ConverterRegistry { public Converter<T> resolveConverter(Object object) { if(object == null) { return null; } Class<?> clazz; if(object instanceof Class) { clazz = (Class<?>) object; } else { clazz = object.getClass(); } synchronized(converterMap) { Converter<T> converter = converterMap.get(clazz); if(converter != null) { return converter; } for(Map.Entry<Class<?>, Converter<T>> current : converterMap.entrySet()) { Class<?> key = current.getKey(); if(key.isAssignableFrom(clazz)) { return current.getValue(); } } return null; } }  void addConverter(Converter<T> converter); Converter<T> resolveConverter(Object object);  }
@Test public void checkEmpty() { assertNull(instance.resolveConverter("foo")); }