@Test
  public void testGeneratingClassLoader() throws Exception {
    System.out.println("\nStarting ClassPathLoaderTest#testGeneratingClassLoader");

    ClassLoader gcl = new GeneratingClassLoader();
    String classToLoad = "com.nowhere.TestGeneratingClassLoader";

    Class<?> clazz = gcl.loadClass(classToLoad);
    assertThat(clazz).isNotNull();
    assertThat(clazz.getName()).isEqualTo(classToLoad);

    Object obj = clazz.newInstance();
    assertThat(obj.getClass().getName()).isEqualTo(clazz.getName());

    assertThatThrownBy(() -> {
      Class.forName(classToLoad);
    }).isInstanceOf(ClassNotFoundException.class);

    Class<?> clazzForName = Class.forName(classToLoad, true, gcl);
    assertThat(clazzForName).isNotNull();
    assertThat(clazzForName).isEqualTo(clazz);

    Object objForName = clazzForName.newInstance();
    assertThat(objForName.getClass().getName()).isEqualTo(classToLoad);
  }
Verifies that the {@link GeneratingClassLoader} works and always generates the named class.
This is a control which ensures that tests depending on <tt>GeneratingClassLoader</tt> are
valid.
geode-core/src/test/java/org/apache/geode/internal/classloader/ClassPathLoaderTest.java