### Question:
EnhancedServiceLoader { public static <S> S load(Class<S> service, ClassLoader loader) throws EnhancedServiceNotFoundException { return InnerEnhancedServiceLoader.getServiceLoader(service).load(loader); }  static S load(Class<S> service, ClassLoader loader); static S load(Class<S> service); static S load(Class<S> service, String activateName); static S load(Class<S> service, String activateName, ClassLoader loader); static S load(Class<S> service, String activateName, Object[] args); static S load(Class<S> service, String activateName, Class[] argsType, Object[] args); static List<S> loadAll(Class<S> service); static List<S> loadAll(Class<S> service, Class[] argsType, Object[] args);  }### Answer:
@Test public void testLoadByClassAndClassLoader() { Hello load = EnhancedServiceLoader.load(Hello.class, Hello.class.getClassLoader()); Assertions.assertEquals(load.say(), "Olá."); }
@Test public void testLoadException() { Assertions.assertThrows(EnhancedServiceNotFoundException.class, () -> { EnhancedServiceLoaderTest load = EnhancedServiceLoader.load(EnhancedServiceLoaderTest.class); }); }
@Test public void testLoadByClass() { Hello load = EnhancedServiceLoader.load(Hello.class); assertThat(load.say()).isEqualTo("Olá."); }
@Test public void testLoadByClassAndActivateName() { Hello englishHello = EnhancedServiceLoader.load(Hello.class, "EnglishHello"); assertThat(englishHello.say()).isEqualTo("hello!"); }
@Test public void testLoadByClassAndClassLoaderAndActivateName() { Hello englishHello = EnhancedServiceLoader .load(Hello.class, "EnglishHello", EnhancedServiceLoaderTest.class.getClassLoader()); assertThat(englishHello.say()).isEqualTo("hello!"); }
@Test public void getSingletonExtensionInstance(){ Hello hello1 = EnhancedServiceLoader.load(Hello.class, "ChineseHello"); Hello hello2 = EnhancedServiceLoader.load(Hello.class, "ChineseHello"); assertThat(hello1 == hello2).isTrue(); }
@Test public void getMultipleExtensionInstance(){ Hello hello1 = EnhancedServiceLoader.load(Hello.class, "LatinHello"); Hello hello2 = EnhancedServiceLoader.load(Hello.class, "LatinHello"); assertThat(hello1 == hello2).isFalse(); }