### Question:
SingleProviderResolver { public static <T> T resolveMandatory(Class<T> c) { T obj = resolve(c); if (obj == null) { Error err = new LinkageError("No implementation found for: " + c.getName()); throw err; } return obj; }  static T resolveMandatory(Class<T> c); static T resolve(Class<T> c); @SuppressWarnings("unchecked") static synchronized T resolve(Class<T> c, Class<? extends T> defaultImpl);  }### Answer:
@Test(expected = LinkageError.class) public void testUnknownButMandatory() { SingleProviderResolver.resolveMandatory(Unknown.class); }
@Test(expected = LinkageError.class) public void testNonsense() { SingleProviderResolver.resolveMandatory(Integer.class); }
@Test(expected = ServiceConfigurationError.class) public void testServiceLoaderConfigurationError() { SingleProviderResolver.resolveMandatory(ServiceLoaderConfigurationError.class); }
@Test public void testFallbackToServiceLoader() { assertNotNull(SingleProviderResolver.resolveMandatory(KnownServiceLoader.class)); }