Mappers { public static <T> Class<? extends T> getMapperClass(Class<T> clazz) { try { List<ClassLoader> classLoaders = collectClassLoaders( clazz.getClassLoader() ); return getMapperClass( clazz, classLoaders ); } catch ( ClassNotFoundException e ) { throw new RuntimeException( e ); } } private  Mappers(); static T getMapper(Class<T> clazz); static Class<? extends T> getMapperClass(Class<T> clazz);  }
@Test public void shouldReturnImplementationClass() { Class<? extends Foo> mapperClass = Mappers.getMapperClass( Foo.class ); assertThat( mapperClass ).isNotNull(); assertThat( mapperClass ).isNotExactlyInstanceOf( Foo.class ); }
@Test public void findsNestedMapperImplClass() { assertThat( Mappers.getMapperClass( SomeClass.Foo.class ) ).isNotNull(); assertThat( Mappers.getMapperClass( SomeClass.NestedClass.Foo.class ) ).isNotNull(); }
@Test public void shouldReturnPackagePrivateImplementationClass() { assertThat( Mappers.getMapperClass( PackagePrivateMapper.class ) ).isNotNull(); }