/** * Invoke with a {@link org.junit.runner.Runner} to cause all tests it intends to run * to first be checked with the filter. Only those that pass the filter will be run. * * @param child the runner to be filtered by the receiver * @throws NoTestsRemainException if the receiver removes all tests */ public void apply(Object child) throws NoTestsRemainException { if (!(child instanceof Filterable)) { return; } Filterable filterable = (Filterable) child; filterable.filter(this); }
/** * Invoke with a {@link org.junit.runner.Runner} to cause all tests it intends to run * to first be checked with the filter. Only those that pass the filter will be run. * * @param child the runner to be filtered by the receiver * @throws NoTestsRemainException if the receiver removes all tests */ public void apply(Object child) throws NoTestsRemainException { if (!(child instanceof Filterable)) { return; } Filterable filterable = (Filterable) child; filterable.filter(this); }
@Override public void filter(Filter filter) throws NoTestsRemainException { ((Filterable) runner).filter(filter); } }
private boolean tryToFilterRunner(Description description) { if (runner instanceof Filterable) { ExcludeDescriptionFilter filter = new ExcludeDescriptionFilter(description); try { ((Filterable) runner).filter(filter); } catch (NoTestsRemainException ignore) { // it's safe to ignore this exception because childless TestDescriptors will get pruned } return filter.wasSuccessful(); } return false; }
public void filter(Filter filter) throws NoTestsRemainException { if (getTest() instanceof Filterable) { Filterable adapter = (Filterable) getTest(); adapter.filter(filter); } else if (getTest() instanceof TestSuite) { TestSuite suite = (TestSuite) getTest(); TestSuite filtered = new TestSuite(suite.getName()); int n = suite.testCount(); for (int i = 0; i < n; i++) { Test test = suite.testAt(i); if (filter.shouldRun(makeDescription(test))) { filtered.addTest(test); } } setTest(filtered); } }
public void filter(Filter filter) throws NoTestsRemainException { if (getTest() instanceof Filterable) { Filterable adapter = (Filterable) getTest(); adapter.filter(filter); } else if (getTest() instanceof TestSuite) { TestSuite suite = (TestSuite) getTest(); TestSuite filtered = new TestSuite(suite.getName()); int n = suite.testCount(); for (int i = 0; i < n; i++) { Test test = suite.testAt(i); if (filter.shouldRun(makeDescription(test))) { filtered.addTest(test); } } setTest(filtered); if (filtered.testCount() == 0) { throw new NoTestsRemainException(); } } }
/** * Delegates to the inner runner to filter. * * @param filter the {@link Filter} from JUnit to select a single test. * @throws NoTestsRemainException */ @Override public void filter(Filter filter) throws NoTestsRemainException { if (delegate instanceof Filterable) { ((Filterable) delegate).filter(filter); } } }
/** * Invoke with a {@link org.junit.runner.Runner} to cause all tests it intends to run * to first be checked with the filter. Only those that pass the filter will be run. * * @param child the runner to be filtered by the receiver * @throws NoTestsRemainException if the receiver removes all tests */ public void apply(Object child) throws NoTestsRemainException { if (!(child instanceof Filterable)) { return; } Filterable filterable = (Filterable) child; filterable.filter(this); }
private void filterIfRequired(final ResultCollector rc, final Runner runner) { if (this.filter.isPresent()) { if (!(runner instanceof Filterable)) { LOG.warning("Not able to filter " + runner.getDescription() + ". Mutation may have prevented JUnit from constructing test"); return; } final Filterable f = (Filterable) runner; try { f.filter(this.filter.get()); } catch (final NoTestsRemainException e1) { rc.notifySkipped(this.getDescription()); return; } } }
public void filter(Filter filter) throws NoTestsRemainException { if (getTest() instanceof Filterable) { Filterable adapter = (Filterable) getTest(); adapter.filter(filter); } else if (getTest() instanceof TestSuite) { TestSuite suite = (TestSuite) getTest(); TestSuite filtered = new TestSuite(suite.getName()); int n = suite.testCount(); for (int i = 0; i < n; i++) { Test test = suite.testAt(i); if (filter.shouldRun(makeDescription(test))) { filtered.addTest(test); } } setTest(filtered); } }
@Override public void filter(final Filter filter) throws NoTestsRemainException { if (delegate instanceof Filterable) { ((Filterable) delegate).filter(filter); } }
@Override public void filter(Filter filter) throws NoTestsRemainException { ((Filterable) runner).filter(filter); }
public void filter(Filter filter) throws NoTestsRemainException { if (runner instanceof Filterable) { ((Filterable) runner).filter(filter); } }
/** * Delegates to the inner runner to filter. * * @param filter the {@link Filter} from JUnit to select a single test. * @throws NoTestsRemainException */ @Override public void filter(Filter filter) throws NoTestsRemainException { if (delegate instanceof Filterable) { ((Filterable) delegate).filter(filter); } } }
@Override public void filter(Filter filter) throws NoTestsRemainException { if (childRunner instanceof Filterable) { ((Filterable) childRunner).filter(filter); } }
public void filter(Filter filter) throws NoTestsRemainException { if (runner instanceof Filterable) { ((Filterable) runner).filter(filter); } }
public void filter(Filter filter) throws NoTestsRemainException { ((Filterable) sputnik).filter(filter); }
/** * Invoke with a {@link org.junit.runner.Runner} to cause all tests it intends to run * to first be checked with the filter. Only those that pass the filter will be run. * * @param child the runner to be filtered by the receiver * @throws NoTestsRemainException if the receiver removes all tests */ public void apply(Object child) throws NoTestsRemainException { if (!(child instanceof Filterable)) { return; } Filterable filterable = (Filterable) child; filterable.filter(this); }
@Override public void filter( Filter filter ) throws NoTestsRemainException { for( Runner runner : getChildren() ) { if( runner instanceof Filterable ) ( (Filterable) runner ).filter( filter ); } } }
@Override public void filter( Filter filter ) throws NoTestsRemainException { for( Runner runner : getChildren() ) { if( runner instanceof Filterable ) ( (Filterable) runner ).filter( filter ); } } }