ReflectHelpers { public static <T> Iterable<T> loadServicesOrdered(Class<T> iface, ClassLoader classLoader) { ServiceLoader<T> loader = ServiceLoader.load(iface, classLoader); ImmutableSortedSet.Builder<T> builder = new ImmutableSortedSet.Builder<>(ObjectsClassComparator.INSTANCE); builder.addAll(loader); return builder.build(); }  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 testLoadServicesOrderedReordersClassesByName() { List<String> names = new ArrayList<>(); for (FakeService service : ReflectHelpers.loadServicesOrdered(FakeService.class)) { names.add(service.getName()); } assertThat(names, contains("Alpha", "Zeta")); }