Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude tests where TestPlan is empty
- Loading branch information
1 parent
d20d0a6
commit 1fcc502
Showing
3 changed files
with
48 additions
and
36 deletions.
There are no files selected for viewing
22 changes: 0 additions & 22 deletions
22
surefire-junit5/src/main/java/org/junit/gen5/surefire/AcceptAllClassesScannerFilter.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
surefire-junit5/src/main/java/org/junit/gen5/surefire/TestPlanScannerFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
/* | |||
* Copyright 2015 the original author or authors. | |||
* | |||
* All rights reserved. This program and the accompanying materials are | |||
* made available under the terms of the Eclipse Public License v1.0 which | |||
* accompanies this distribution and is available at | |||
* | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
*/ | |||
|
|||
package org.junit.gen5.surefire; | |||
|
|||
import static org.junit.gen5.engine.TestPlanSpecification.build; | |||
|
|||
import org.apache.maven.surefire.util.ScannerFilter; | |||
import org.junit.gen5.engine.TestPlanSpecification; | |||
import org.junit.gen5.launcher.Launcher; | |||
import org.junit.gen5.launcher.TestPlan; | |||
|
|||
final class TestPlanScannerFilter implements ScannerFilter { | |||
|
|||
private final Launcher launcher; | |||
|
|||
public TestPlanScannerFilter(Launcher launcher) { | |||
this.launcher = launcher; | |||
} | |||
|
|||
@SuppressWarnings("rawtypes") | |||
@Override | |||
public boolean accept(Class testClass) { | |||
TestPlanSpecification specification = build(TestPlanSpecification.forClass(testClass)); | |||
TestPlan testPlan = launcher.discover(specification); | |||
return testPlan.hasTests(); | |||
} | |||
} |