How to run a JUnit test programatically and specify a classpath

Solution 1:

When building the request you can select classpath roots via org.junit.platform.engine.discovery.ClasspathRootSelector.