### Question:
ExtensionLoader { @SuppressWarnings("unchecked") public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) { if (type == null) { throw new IllegalArgumentException("Extension type == null"); } if (!type.isInterface()) { throw new IllegalArgumentException("Extension type(" + type + ") is not interface!"); } if (!withExtensionAnnotation(type)) { throw new IllegalArgumentException("Extension type(" + type + ") is not extension, because WITHOUT @" + SPI.class.getSimpleName() + " Annotation!"); } ExtensionLoader<T> loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); if (loader == null) { EXTENSION_LOADERS.putIfAbsent(type, new ExtensionLoader<T>(type)); loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); } return loader; } private  ExtensionLoader(Class<?> type); @SuppressWarnings("unchecked") static ExtensionLoader<T> getExtensionLoader(Class<T> type); static void resetExtensionLoader(Class type); String getExtensionName(T extensionInstance); String getExtensionName(Class<?> extensionClass); List<T> getActivateExtension(URL url, String key); List<T> getActivateExtension(URL url, String[] values); List<T> getActivateExtension(URL url, String key, String group); List<T> getActivateExtension(URL url, String[] values, String group); @SuppressWarnings("unchecked") T getLoadedExtension(String name); Set<String> getLoadedExtensions(); Object getLoadedAdaptiveExtensionInstances(); @SuppressWarnings("unchecked") T getExtension(String name); T getDefaultExtension(); boolean hasExtension(String name); Set<String> getSupportedExtensions(); String getDefaultExtensionName(); void addExtension(String name, Class<?> clazz); @Deprecated void replaceExtension(String name, Class<?> clazz); @SuppressWarnings("unchecked") T getAdaptiveExtension(); @Override String toString();  }### Answer:
@Test public void test_getExtensionLoader_Null() throws Exception { try { ExtensionLoader.getExtensionLoader(null); fail(); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage(), containsString("Extension type == null")); } }
@Test public void test_getExtensionLoader_NotInterface() throws Exception { try { ExtensionLoader.getExtensionLoader(ExtensionLoaderTest.class); fail(); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage(), containsString("Extension type(class org.apache.dubbo.common.extension.ExtensionLoaderTest) is not interface")); } }
@Test public void test_getExtensionLoader_NotSpiAnnotation() throws Exception { try { ExtensionLoader.getExtensionLoader(NoSpiExt.class); fail(); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage(), allOf(containsString("org.apache.dubbo.common.extension.NoSpiExt"), containsString("is not extension"), containsString("WITHOUT @SPI Annotation"))); } }