org.junit.runner.manipulation.NoTestsRemainException Java Examples
The following examples show how to use
org.junit.runner.manipulation.NoTestsRemainException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractGremlinSuite.java From tinkerpop with Apache License 2.0 | 6 votes |
private void registerOptOuts(final Class<?> classWithOptOuts, final Optional<GraphProvider.Descriptor> graphProviderDescriptor, final TraversalEngine.Type traversalEngineType) throws InitializationError { // don't get why getAnnotationsByType() refuses to pick up OptOuts on the superclass. doing it manually and // only for the immediate superclass for now final List<Graph.OptOut> optOuts = getAllOptOuts(classWithOptOuts); if (!optOuts.isEmpty()) { // validate annotation - test class and reason must be set if (!optOuts.stream().allMatch(ignore -> ignore.test() != null && ignore.reason() != null && !ignore.reason().isEmpty())) throw new InitializationError("Check @IgnoreTest annotations - all must have a 'test' and 'reason' set"); try { final Graph.OptOut[] oos = new Graph.OptOut[optOuts.size()]; optOuts.toArray(oos); filter(new OptOutTestFilter(oos, graphProviderDescriptor, traversalEngineType)); } catch (NoTestsRemainException ex) { throw new InitializationError(ex); } } }
Example #2
Source File: AdaptedJUnitTestUnit.java From pitest with Apache License 2.0 | 6 votes |
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; } } }
Example #3
Source File: HashemTestRunner.java From mr-hashemi with Universal Permissive License v1.0 | 5 votes |
public static void runInMain(Class<?> testClass, String[] args) throws InitializationError, NoTestsRemainException { JUnitCore core = new JUnitCore(); core.addListener(new TextListener(System.out)); HashemTestRunner suite = new HashemTestRunner(testClass); if (args.length > 0) { suite.filter(new NameFilter(args[0])); } Result r = core.run(suite); if (!r.wasSuccessful()) { System.exit(1); } }
Example #4
Source File: AbstractMultiTestRunner.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void runEnabledTests(RunNotifier nested) { if (enabledTests.isEmpty()) { return; } Runner runner; try { runner = createExecutionRunner(); } catch (Throwable t) { runner = new CannotExecuteRunner(getDisplayName(), target, t); } try { if (!disabledTests.isEmpty()) { ((Filterable) runner).filter(new Filter() { @Override public boolean shouldRun(Description description) { return !disabledTests.contains(description); } @Override public String describe() { return "disabled tests"; } }); } } catch (NoTestsRemainException e) { return; } runner.run(nested); }
Example #5
Source File: AbstractMultiTestRunner.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void runEnabledTests(RunNotifier nested) { if (enabledTests.isEmpty()) { return; } Runner runner; try { runner = createExecutionRunner(); } catch (Throwable t) { runner = new CannotExecuteRunner(getDisplayName(), target, t); } try { if (!disabledTests.isEmpty()) { ((Filterable) runner).filter(new Filter() { @Override public boolean shouldRun(Description description) { return !disabledTests.contains(description); } @Override public String describe() { return "disabled tests"; } }); } } catch (NoTestsRemainException e) { return; } runner.run(nested); }
Example #6
Source File: WycheproofRunner.java From wycheproof with Apache License 2.0 | 5 votes |
private void addFilter(Filter filter) { try { filter(filter); } catch (NoTestsRemainException ex) { System.out.println("No tests remain exception: " + ex); } }
Example #7
Source File: FilterRegistry.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Initializes the test filter. * * @param parentRunner * the {@link ParentRunner} to initialize, must not be {@code null} */ public static void initializeFilter(final ParentRunner<?> parentRunner) { try { parentRunner.filter(INSTANCE); } catch (NoTestsRemainException e) { // we ignore the case where no children are left } }
Example #8
Source File: AbstractMultiTestRunner.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void runEnabledTests(RunNotifier nested) { if (enabledTests.isEmpty()) { return; } Runner runner; try { runner = createExecutionRunner(); } catch (Throwable t) { runner = new CannotExecuteRunner(getDisplayName(), target, t); } try { if (!disabledTests.isEmpty()) { ((Filterable) runner).filter(new Filter() { @Override public boolean shouldRun(Description description) { return !disabledTests.contains(description); } @Override public String describe() { return "disabled tests"; } }); } } catch (NoTestsRemainException e) { return; } runner.run(nested); }
Example #9
Source File: AbstractMultiTestRunner.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void runEnabledTests(RunNotifier nested) { if (enabledTests.isEmpty()) { return; } Runner runner; try { runner = createExecutionRunner(); } catch (Throwable t) { runner = new CannotExecuteRunner(getDisplayName(), target, t); } try { if (!disabledTests.isEmpty()) { ((Filterable) runner).filter(new Filter() { @Override public boolean shouldRun(Description description) { return !disabledTests.contains(description); } @Override public String describe() { return "disabled tests"; } }); } } catch (NoTestsRemainException e) { return; } runner.run(nested); }
Example #10
Source File: TestRequestBuilder.java From android-test with Apache License 2.0 | 5 votes |
@Override public Runner getRunner() { try { Runner runner = request.getRunner(); filter.apply(runner); return runner; } catch (NoTestsRemainException e) { // don't treat filtering out all tests as an error return new BlankRunner(); } }
Example #11
Source File: LdapConditionallyFilteredTestRunner.java From spring-ldap with Apache License 2.0 | 5 votes |
/** * Constructs a new {@code SpringJUnit4ClassRunner} and initializes a * {@link org.springframework.test.context.TestContextManager} to provide Spring testing functionality to * standard JUnit tests. * * @param clazz the test class to be run * @see #createTestContextManager(Class) */ public LdapConditionallyFilteredTestRunner(Class<?> clazz) throws InitializationError { super(clazz); String noadtest = System.getProperty("adtest"); if (noadtest != null) { try { filter(Categories.CategoryFilter.exclude(NoAdTest.class)); } catch (NoTestsRemainException e) { // Nothing to do here. } } }
Example #12
Source File: JUnit4Runner.java From bazel with Apache License 2.0 | 4 votes |
private static Request applyFilter(Request request, Filter filter) throws NoTestsRemainException { Runner runner = request.getRunner(); new SuiteTrimmingFilter(filter).apply(runner); return Request.runner(runner); }
Example #13
Source File: Filters.java From bazel with Apache License 2.0 | 3 votes |
/** * Returns a Request that only contains those tests that should run when * a filter is applied, filtering out all empty suites.<p> * * Note that if the request passed into this method caches its runner, * that runner will be modified to use the given filter. To be safe, * do not use the passed-in request after calling this method. * * @param request Request to filter * @param filter Filter to apply * @return request * @throws NoTestsRemainException if the applying the filter removes all tests */ public static Request apply(Request request, Filter filter) throws NoTestsRemainException { filter = new SuiteTrimmingFilter(filter); Runner runner = request.getRunner(); filter.apply(runner); return Request.runner(runner); }