Package org.apache.maven.surefire.junit4
Class JUnit4Provider
- java.lang.Object
-
- org.apache.maven.surefire.providerapi.AbstractProvider
-
- org.apache.maven.surefire.junit4.JUnit4Provider
-
- All Implemented Interfaces:
SurefireProvider
public class JUnit4Provider extends AbstractProvider
-
-
Field Summary
Fields Modifier and Type Field Description private CommandReadercommandsReaderprivate java.lang.StringcustomRunListenersprivate JUnit4TestCheckerjUnit4TestCheckerprivate ProviderParametersproviderParametersprivate intrerunFailingTestsCountprivate RunOrderCalculatorrunOrderCalculatorprivate ScanResultscanResultprivate java.lang.ClassLoadertestClassLoaderprivate TestListResolvertestResolverprivate TestsToRuntestsToRunprivate static java.lang.StringUNDETERMINED_TESTS_DESCRIPTION
-
Constructor Summary
Constructors Constructor Description JUnit4Provider(ProviderParameters bootParams)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static intcountTestsInRunner(org.junit.runner.Description description)JUnit error: test count includes one test-class as a suite which has filtered out all children.private org.junit.runner.manipulation.FiltercreateMethodFilter()(package private) static org.junit.runner.DescriptioncreateTestsDescription(java.lang.Iterable<java.lang.Class<?>> classes)private static voidexecute(java.lang.Class<?> testClass, Notifier notifier, org.junit.runner.manipulation.Filter filter)private voidexecuteTestSet(java.lang.Class<?> clazz, RunListener reporter, Notifier notifier)private voidexecuteWithRerun(java.lang.Class<?> clazz, Notifier notifier)private intgetSkipAfterFailureCount()java.lang.Iterable<java.lang.Class<?>>getSuites()Determines the number of forks.private static booleanhasFilteredOutAllChildren(org.junit.runner.Description description)RunResultinvoke(java.lang.Object forkTestSet)Runs a forked testprivate booleanisFailFast()private static booleanisJUnit4UpgradeCheck()private booleanisRerunFailingTests()private voidregisterPleaseStopJUnitListener(Notifier notifier)private voidregisterShutdownListener(TestsToRun testsToRun)private TestsToRunscanClassPath()private voidsetTestsToRun(java.lang.Object forkTestSet)private voidupgradeCheck()-
Methods inherited from class org.apache.maven.surefire.providerapi.AbstractProvider
cancel
-
-
-
-
Field Detail
-
UNDETERMINED_TESTS_DESCRIPTION
private static final java.lang.String UNDETERMINED_TESTS_DESCRIPTION
- See Also:
- Constant Field Values
-
testClassLoader
private final java.lang.ClassLoader testClassLoader
-
customRunListeners
private final java.lang.String customRunListeners
-
jUnit4TestChecker
private final JUnit4TestChecker jUnit4TestChecker
-
testResolver
private final TestListResolver testResolver
-
providerParameters
private final ProviderParameters providerParameters
-
runOrderCalculator
private final RunOrderCalculator runOrderCalculator
-
scanResult
private final ScanResult scanResult
-
rerunFailingTestsCount
private final int rerunFailingTestsCount
-
commandsReader
private final CommandReader commandsReader
-
testsToRun
private TestsToRun testsToRun
-
-
Constructor Detail
-
JUnit4Provider
public JUnit4Provider(ProviderParameters bootParams)
-
-
Method Detail
-
invoke
public RunResult invoke(java.lang.Object forkTestSet) throws TestSetFailedException
Description copied from interface:SurefireProviderRuns a forked test- Parameters:
forkTestSet- An item from the iterator in #getSuites. Will be null for forkmode never or always. When this is non-null, the forked process will run only that test and probably not scan the classpath- Returns:
- A result of the invocation
- Throws:
TestSetFailedException- When testset fails
-
setTestsToRun
private void setTestsToRun(java.lang.Object forkTestSet) throws TestSetFailedException- Throws:
TestSetFailedException
-
isRerunFailingTests
private boolean isRerunFailingTests()
-
isFailFast
private boolean isFailFast()
-
getSkipAfterFailureCount
private int getSkipAfterFailureCount()
-
registerShutdownListener
private void registerShutdownListener(TestsToRun testsToRun)
-
registerPleaseStopJUnitListener
private void registerPleaseStopJUnitListener(Notifier notifier)
-
executeTestSet
private void executeTestSet(java.lang.Class<?> clazz, RunListener reporter, Notifier notifier)
-
executeWithRerun
private void executeWithRerun(java.lang.Class<?> clazz, Notifier notifier)
-
getSuites
public java.lang.Iterable<java.lang.Class<?>> getSuites()
Description copied from interface:SurefireProviderDetermines the number of forks.
Called when forkmode is different from "never" or "always", allows the provider to define how to behave for the fork.- Returns:
- An iterator that will trigger one fork per item
-
scanClassPath
private TestsToRun scanClassPath()
-
upgradeCheck
private void upgradeCheck() throws TestSetFailedException- Throws:
TestSetFailedException
-
createTestsDescription
static org.junit.runner.Description createTestsDescription(java.lang.Iterable<java.lang.Class<?>> classes)
-
isJUnit4UpgradeCheck
private static boolean isJUnit4UpgradeCheck()
-
execute
private static void execute(java.lang.Class<?> testClass, Notifier notifier, org.junit.runner.manipulation.Filter filter)
-
countTestsInRunner
private static int countTestsInRunner(org.junit.runner.Description description)
JUnit error: test count includes one test-class as a suite which has filtered out all children. Then the child test has a description "initializationError0(org.junit.runner.manipulation.Filter)" for JUnit 4.0 or "initializationError(org.junit.runner.manipulation.Filter)" for JUnit 4.12 and Description#isTest() returns true, but this description is not a real test and therefore it should not be included in the entire test count.
-
hasFilteredOutAllChildren
private static boolean hasFilteredOutAllChildren(org.junit.runner.Description description)
-
createMethodFilter
private org.junit.runner.manipulation.Filter createMethodFilter()
-
-