### Question:
SpiLoader { @SuppressWarnings("unchecked") public static <T> SpiLoader<T> getLoader(Class<T> type) { if (type == null) { throw new IllegalArgumentException("Spi type must not be null"); } if (!type.isInterface()) { throw new IllegalArgumentException("Spi type " + type.getName() + " must an interface"); } if (!type.isAnnotationPresent(Spi.class)) { throw new IllegalArgumentException("Spi type " + type.getName() + " must annotated with @Spi"); } return LOADERS.computeIfAbsent(type, t -> new SpiLoader(t)); } private  SpiLoader(Class<T> type); @SuppressWarnings("unchecked") static SpiLoader<T> getLoader(Class<T> type); T getExtension(); T getExtension(String key);  }### Answer:
@DisplayName("test_getLoader_Null") @Test void testGetLoaderNull() { try { SpiLoader.getLoader(null); fail(); } catch (IllegalArgumentException e) { assertEquals("Spi type must not be null", e.getMessage()); } }
@DisplayName("test_getLoader_NotInterface") @Test void testGetLoaderNotInterface() { try { SpiLoader.getLoader(SimpleOutput.class); fail(); } catch (IllegalArgumentException e) { assertEquals("Spi type io.github.ukuz.piccolo.api.spi.SimpleOutput must an interface", e.getMessage()); } }
@DisplayName("test_getLoader_NotSpiAnnotation") @Test void testGetLoaderNotSpiAnnotation() { try { SpiLoader.getLoader(Output.class); fail(); } catch (IllegalArgumentException e) { assertEquals("Spi type io.github.ukuz.piccolo.api.spi.Output must annotated with @Spi", e.getMessage()); } }
@SuppressWarnings("unchecked") @DisplayName("test_getLoader") @Test void testGetLoader() { SpiLoader<Input> loader = SpiLoader.getLoader(Input.class); assertNotNull(loader); }