Class FacadeClassLoader

java.lang.Object
java.lang.ClassLoader
io.quarkus.test.junit.classloading.FacadeClassLoader
All Implemented Interfaces:
Closeable, AutoCloseable

public final class FacadeClassLoader extends ClassLoader implements Closeable
JUnit has many interceptors and listeners, but it does not allow us to intercept test discovery in a fine-grained way that would allow us to swap the thread context classloader. Since we can't intercept with a JUnit hook, we hijack from inside the classloader.

We need to load all our test classes in one go, during the discovery phase, before we start the applications. We may need several applications and therefore, several classloaders, depending on what profiles are set. To solve that, we prepare the applications, to get classloaders, and file them here.

Final, since some code does instanceof checks using the class name.