ReflectHelpers { public static String simpleTypeDescription(Type input) { StringBuilder builder = new StringBuilder(); format(builder, input); return builder.toString(); }  static String formatMethod(Method input); static String formatMethodWithClass(Method input); static String formatAnnotation(Annotation annotation); static String simpleTypeDescription(Type input); static Iterable<Method> getClosureOfMethodsOnInterfaces(
      Iterable<? extends Class<?>> interfaces); static Iterable<Method> getClosureOfMethodsOnInterface(Class<?> iface); static Iterable<T> loadServicesOrdered(Class<T> iface, ClassLoader classLoader); static Iterable<T> loadServicesOrdered(Class<T> iface); static ClassLoader findClassLoader(final ClassLoader proposed); static ClassLoader findClassLoader(final Class<?>... classes); static ClassLoader findClassLoader();  }
@Test public void testTypeFormatterOnClasses() throws Exception { assertEquals("Integer", ReflectHelpers.simpleTypeDescription(Integer.class)); assertEquals("int", ReflectHelpers.simpleTypeDescription(int.class)); assertEquals("Map", ReflectHelpers.simpleTypeDescription(Map.class)); assertEquals(getClass().getSimpleName(), ReflectHelpers.simpleTypeDescription(getClass())); }
@Test public void testTypeFormatterOnArrays() throws Exception { assertEquals("Integer[]", ReflectHelpers.simpleTypeDescription(Integer[].class)); assertEquals("int[]", ReflectHelpers.simpleTypeDescription(int[].class)); }
@Test public void testTypeFormatterWithGenerics() throws Exception { assertEquals( "Map<Integer, String>", ReflectHelpers.simpleTypeDescription( new TypeDescriptor<Map<Integer, String>>() {}.getType())); assertEquals( "Map<?, String>", ReflectHelpers.simpleTypeDescription(new TypeDescriptor<Map<?, String>>() {}.getType())); assertEquals( "Map<? extends Integer, String>", ReflectHelpers.simpleTypeDescription( new TypeDescriptor<Map<? extends Integer, String>>() {}.getType())); }
@Test public <T> void testTypeFormatterWithWildcards() throws Exception { assertEquals( "Map<T, T>", ReflectHelpers.simpleTypeDescription(new TypeDescriptor<Map<T, T>>() {}.getType())); }
@Test public <InputT, OutputT> void testTypeFormatterWithMultipleWildcards() throws Exception { assertEquals( "Map<? super InputT, ? extends OutputT>", ReflectHelpers.simpleTypeDescription( new TypeDescriptor<Map<? super InputT, ? extends OutputT>>() {}.getType())); }