@Test public void returns_the_driver_from_the_backing_driver_finder() { DriverFinder finder1 = mock(DriverFinder.class, "finder1"); stub(finder1.findTestClassDriver(testClass)).toReturn(expectedDriver); Driver driver = new CompositeDriverFinder(finder1).findTestClassDriver(testClass); assertThat(driver, is(expectedDriver)); }
@Override public Driver findTestClassDriver(Class<?> testClass) { for (DriverFinder finder : finders) { Driver driver = finder.findTestClassDriver(testClass); if (driver != DRIVER_NOT_FOUND) { return driver; } } throw new IllegalArgumentException(testClass + " was not recognized as a compatible test class; tried " + Arrays.toString(finders)); }
CompositeDriverFinder implements DriverFinder { @Override public Driver findTestClassDriver(Class<?> testClass) { for (DriverFinder finder : finders) { Driver driver = finder.findTestClassDriver(testClass); if (driver != DRIVER_NOT_FOUND) { return driver; } } throw new IllegalArgumentException(testClass + " was not recognized as a compatible test class; tried " + Arrays.toString(finders)); } }
CompositeDriverFinder implements DriverFinder { @Override public Driver findTestClassDriver(Class<?> testClass) { for (DriverFinder finder : finders) { Driver driver = finder.findTestClassDriver(testClass); if (driver != DRIVER_NOT_FOUND) { return driver; } } throw new IllegalArgumentException(testClass + " was not recognized as a compatible test class; tried " + Arrays.toString(finders)); } CompositeDriverFinder(List<DriverFinder> finders);  CompositeDriverFinder(DriverFinder... finders); }
CompositeDriverFinder implements DriverFinder { @Override public Driver findTestClassDriver(Class<?> testClass) { for (DriverFinder finder : finders) { Driver driver = finder.findTestClassDriver(testClass); if (driver != DRIVER_NOT_FOUND) { return driver; } } throw new IllegalArgumentException(testClass + " was not recognized as a compatible test class; tried " + Arrays.toString(finders)); } CompositeDriverFinder(List<DriverFinder> finders);  CompositeDriverFinder(DriverFinder... finders); @Override Driver findTestClassDriver(Class<?> testClass); }
CompositeDriverFinder implements DriverFinder { @Override public Driver findTestClassDriver(Class<?> testClass) { for (DriverFinder finder : finders) { Driver driver = finder.findTestClassDriver(testClass); if (driver != DRIVER_NOT_FOUND) { return driver; } } throw new IllegalArgumentException(testClass + " was not recognized as a compatible test class; tried " + Arrays.toString(finders)); } CompositeDriverFinder(List<DriverFinder> finders);  CompositeDriverFinder(DriverFinder... finders); @Override Driver findTestClassDriver(Class<?> testClass);  }