@Test public void does_not_support_JUnit_tests_if_JUnit_not_on_test_classpath() { BlacklistClassLoader noJUnitInThisClassLoader = new BlacklistClassLoader("org.junit.", getClass().getClassLoader()); CompositeDriverFinder finder = DriverFinderFactory.createDriverFinder(noJUnitInThisClassLoader, new PrintStream(logOutput)); Driver driver = finder.findTestClassDriver(JUnitTest.class); assertThat(driver, is(instanceOf(IgnoreSilentlyDriver.class))); assertThat(logOutput.toString(), containsString("JUnit not found on classpath; disabling JUnit compatibility")); }
public static CompositeDriverFinder createDriverFinder(ClassLoader testClassLoader, PrintStream logOutput) { List<DriverFinder> driverFinders = new ArrayList<>(); driverFinders.add(new AbstractClassIgnoringDriverFinder()); driverFinders.add(new RunViaAnnotationDriverFinder()); if (isOnClasspath("org.junit.Test", testClassLoader)) { driverFinders.add(createJUnitCompatibilityDriverFinder(testClassLoader)); } else { logOutput.println("JUnit not found on classpath; disabling JUnit compatibility"); } driverFinders.add(new NonTestClassesIgnoringDriverFinder(logOutput)); return new CompositeDriverFinder(driverFinders); }
DriverFinderFactory { public static CompositeDriverFinder createDriverFinder(ClassLoader testClassLoader, PrintStream logOutput) { List<DriverFinder> driverFinders = new ArrayList<>(); driverFinders.add(new AbstractClassIgnoringDriverFinder()); driverFinders.add(new RunViaAnnotationDriverFinder()); if (isOnClasspath("org.junit.Test", testClassLoader)) { driverFinders.add(createJUnitCompatibilityDriverFinder(testClassLoader)); } else { logOutput.println("JUnit not found on classpath; disabling JUnit compatibility"); } driverFinders.add(new NonTestClassesIgnoringDriverFinder(logOutput)); return new CompositeDriverFinder(driverFinders); } }
DriverFinderFactory { public static CompositeDriverFinder createDriverFinder(ClassLoader testClassLoader, PrintStream logOutput) { List<DriverFinder> driverFinders = new ArrayList<>(); driverFinders.add(new AbstractClassIgnoringDriverFinder()); driverFinders.add(new RunViaAnnotationDriverFinder()); if (isOnClasspath("org.junit.Test", testClassLoader)) { driverFinders.add(createJUnitCompatibilityDriverFinder(testClassLoader)); } else { logOutput.println("JUnit not found on classpath; disabling JUnit compatibility"); } driverFinders.add(new NonTestClassesIgnoringDriverFinder(logOutput)); return new CompositeDriverFinder(driverFinders); }  }
DriverFinderFactory { public static CompositeDriverFinder createDriverFinder(ClassLoader testClassLoader, PrintStream logOutput) { List<DriverFinder> driverFinders = new ArrayList<>(); driverFinders.add(new AbstractClassIgnoringDriverFinder()); driverFinders.add(new RunViaAnnotationDriverFinder()); if (isOnClasspath("org.junit.Test", testClassLoader)) { driverFinders.add(createJUnitCompatibilityDriverFinder(testClassLoader)); } else { logOutput.println("JUnit not found on classpath; disabling JUnit compatibility"); } driverFinders.add(new NonTestClassesIgnoringDriverFinder(logOutput)); return new CompositeDriverFinder(driverFinders); }  static CompositeDriverFinder createDriverFinder(ClassLoader testClassLoader, PrintStream logOutput); }
DriverFinderFactory { public static CompositeDriverFinder createDriverFinder(ClassLoader testClassLoader, PrintStream logOutput) { List<DriverFinder> driverFinders = new ArrayList<>(); driverFinders.add(new AbstractClassIgnoringDriverFinder()); driverFinders.add(new RunViaAnnotationDriverFinder()); if (isOnClasspath("org.junit.Test", testClassLoader)) { driverFinders.add(createJUnitCompatibilityDriverFinder(testClassLoader)); } else { logOutput.println("JUnit not found on classpath; disabling JUnit compatibility"); } driverFinders.add(new NonTestClassesIgnoringDriverFinder(logOutput)); return new CompositeDriverFinder(driverFinders); }  static CompositeDriverFinder createDriverFinder(ClassLoader testClassLoader, PrintStream logOutput);  }