ServiceBootstrap { public static <S extends Ordered> S loadPrimary(Class<S> clazz) { List<S> candidates = loadAllOrdered(clazz); return candidates.get(0); }  static S loadFirst(Class<S> clazz); static Iterator<S> loadAll(Class<S> clazz); static List<S> loadAllOrdered(Class<S> clazz); static S loadPrimary(Class<S> clazz);  }
@Test public void loadPrimarySuccessfully() { Interface6 service = ServiceBootstrap.loadPrimary(Interface6.class); assertTrue(service instanceof Interface6Impl1); }
@Test(expected = IllegalStateException.class) public void loadPrimaryWithServiceFileButNoServiceImpl() { ServiceBootstrap.loadPrimary(Interface7.class); }