  @Test
  public void wrongTypeClass() throws Exception {

    ClassLoader loader = loaderForJarWithEntries(CharSequence.class.getName(), "java.lang.Thread");

    try {
      SimpleServiceLoader.load(CharSequence.class, loader);
      fail();
    } catch (ServiceConfigurationError expected) {
      assertThat(expected).hasMessageThat().startsWith("Class java.lang.Thread is not assignable");
    }
  }