本文整理汇总了Java中org.apache.maven.surefire.testset.TestSetFailedException类的典型用法代码示例。如果您正苦于以下问题:Java TestSetFailedException类的具体用法?Java TestSetFailedException怎么用?Java TestSetFailedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestSetFailedException类属于org.apache.maven.surefire.testset包,在下文中一共展示了TestSetFailedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkPath
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private File checkPath( String path ) throws TestSetFailedException
{
if ( path == null )
{
throw new TestSetFailedException( "Path is null" );
}
File file = new File( path );
if ( !file.exists() )
{
throw new TestSetFailedException( "Path \"" + path + "\" does not exist" );
}
if ( !file.isDirectory() )
{
throw new TestSetFailedException( "Path \"" + path + "\" is not a directory" );
}
return file;
}
示例2: setTestsToRun
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private void setTestsToRun( Object forkTestSet )
throws TestSetFailedException
{
if ( forkTestSet instanceof TestsToRun )
{
testsToRun = (TestsToRun) forkTestSet;
}
else if ( forkTestSet instanceof Class )
{
testsToRun = fromClass( (Class<?>) forkTestSet );
}
else
{
testsToRun = scanClassPath();
}
}
示例3: upgradeCheck
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private void upgradeCheck()
throws TestSetFailedException
{
if ( isJUnit4UpgradeCheck() )
{
Collection<Class<?>> classesSkippedByValidation =
scanResult.getClassesSkippedByValidation( jUnit4TestChecker, testClassLoader );
if ( !classesSkippedByValidation.isEmpty() )
{
StringBuilder reason = new StringBuilder();
reason.append( "Updated check failed\n" );
reason.append( "There are tests that would be run with junit4 / surefire 2.6 but not with [2.7,):\n" );
for ( Class<?> testClass : classesSkippedByValidation )
{
reason.append( " " );
reason.append( testClass.getName() );
reason.append( "\n" );
}
throw new TestSetFailedException( reason.toString() );
}
}
}
示例4: execute
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private static void execute( Class<?> testClass, Notifier notifier, Filter filter )
throws TestSetFailedException
{
final int classModifiers = testClass.getModifiers();
if ( !isAbstract( classModifiers ) && !isInterface( classModifiers ) )
{
Request request = aClass( testClass );
if ( filter != null )
{
request = request.filterWith( filter );
}
Runner runner = request.getRunner();
if ( countTestsInRunner( runner.getDescription() ) != 0 )
{
executeInPlayContext( runner, notifier );
}
}
}
示例5: executeFailedMethod
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private void executeFailedMethod( RunNotifier notifier, Set<ClassMethod> failedMethods )
throws TestSetFailedException
{
for ( ClassMethod failedMethod : failedMethods )
{
try
{
Class<?> methodClass = Class.forName( failedMethod.getClazz(), true, testClassLoader );
String methodName = failedMethod.getMethod();
Runner runner = method( methodClass, methodName ).getRunner();
executeInPlayContext( runner, notifier );
}
catch ( ClassNotFoundException e )
{
throw new TestSetFailedException( "Unable to create test class '" + failedMethod.getClazz() + "'", e );
}
}
}
示例6: getTestsToRun
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private TestsToRun getTestsToRun(Object forkTestSet) throws TestSetFailedException {
if (forkTestSet instanceof TestsToRun) {
return (TestsToRun) forkTestSet;
} else if (forkTestSet instanceof Class) {
return fromClass((Class<?>) forkTestSet);
} else {
return (TestsToRun) getSuites();
}
}
示例7: getPlayHome
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private File getPlayHome( File applicationPath )
throws TestSetFailedException
{
File targetDir = new File( applicationPath, "target" );
File playTmpDir = new File( targetDir, "play" );
File playTmpHomeDir = new File( playTmpDir, "home" );
if ( !playTmpHomeDir.exists() )
{
throw new TestSetFailedException( String.format( "Play! home directory \"%s\" does not exist",
playTmpHomeDir.getAbsolutePath() ) );
}
if ( !playTmpHomeDir.isDirectory() )
{
throw new TestSetFailedException( String.format( "Play! home directory \"%s\" is not a directory",
playTmpHomeDir.getAbsolutePath() ) );
}
// Additional check whether the temporary Play! home directory is created by this plugin
File warningFile = new File( playTmpHomeDir, "WARNING.txt" );
if ( warningFile.exists() )
{
if ( !warningFile.isFile() )
{
throw new TestSetFailedException( String.format( "Play! home directory warning file \"%s\" is not a file",
warningFile.getAbsolutePath() ) );
}
}
else
{
throw new TestSetFailedException( String.format( "Play! home directory warning file \"%s\" does not exist",
warningFile.getAbsolutePath() ) );
}
return playTmpHomeDir;
}
示例8: initializePlayEngine
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private void initializePlayEngine()
throws TestSetFailedException
{
File applicationPath = getApplicationPath();
File playHome = getPlayHome( applicationPath );
String playId = getProviderProperty( "play.testId", "test" );
int playStartTimeout = Integer.parseInt( getProviderProperty( "play.startTimeout", "0" ) );
runRunnable( new PlayStartRunnable( playHome, applicationPath, playId ), "Play! initialization",
playStartTimeout );
}
示例9: executeWithRerun
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private void executeWithRerun( Class<?> clazz, Notifier notifier )
throws TestSetFailedException
{
JUnitTestFailureListener failureListener = new JUnitTestFailureListener();
notifier.addListener( failureListener );
boolean hasMethodFilter = testResolver != null && testResolver.hasMethodPatterns();
try
{
try
{
notifier.asFailFast( isFailFast() );
execute( clazz, notifier, hasMethodFilter ? createMethodFilter() : null );
}
finally
{
notifier.asFailFast( false );
}
// Rerun failing tests if rerunFailingTestsCount is larger than 0
if ( isRerunFailingTests() )
{
Notifier rerunNotifier = pureNotifier();
notifier.copyListenersTo( rerunNotifier );
for ( int i = 0; i < rerunFailingTestsCount && !failureListener.getAllFailures().isEmpty(); i++ )
{
Set<ClassMethod> failedTests = generateFailingTests( failureListener.getAllFailures() );
failureListener.reset();
if ( !failedTests.isEmpty() )
{
executeFailedMethod( rerunNotifier, failedTests );
}
}
}
}
finally
{
notifier.removeListener( failureListener );
}
}
示例10: executeInPlayContext
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private static void executeInPlayContext( Runner runner, RunNotifier notifier )
throws TestSetFailedException
{
try
{
Invoker.invokeInThread( new TestInvocation( runner, notifier ) );
}
catch ( Throwable e )
{
throw new TestSetFailedException( e );
}
}
示例11: invoke
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
@Override
public RunResult invoke(Object forkTestSet) throws TestSetFailedException,
ReporterException, InvocationTargetException {
if (forkTestSet == null) {
RunResult r = RunResult.noTestsRun();
@SuppressWarnings("rawtypes")
Iterator<Class> i = getSuites();
while (i.hasNext()) {
r = r.aggregate(invoke(i.next()));
}
return r;
}
ReporterFactory reporterFactory = providerParameters
.getReporterFactory();
ConsoleLogger consoleLogger = providerParameters.getConsoleLogger();
RunListener rl = reporterFactory.createReporter();
if (!(forkTestSet instanceof Class)) {
throw new TestSetFailedException(
"Unexpected error. Received parameter is not a class");
}
@SuppressWarnings("unchecked")
Class<T> underTest = (Class<T>) forkTestSet;
TestResultListener<T> listener = new PowerUnitProviderListener<>(
consoleLogger, rl, underTest);
DefaultPowerUnitRunnerImpl<T> runner = new DefaultPowerUnitRunnerImpl<>(
underTest);
runner.addListener(listener);
runner.run();
return reporterFactory.close();
}
示例12: invoke
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
public RunResult invoke(Object forkTestSet) throws TestSetFailedException, ReporterException, InvocationTargetException {
final TestsToRun orderedTests = getTestsToRun(forkTestSet);
this.surefireProvider = surefireProviderFactory.createInstance();
return surefireProvider.invoke(orderedTests);
}
示例13: getApplicationPath
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private File getApplicationPath()
throws TestSetFailedException
{
return checkPath( System.getProperty( "user.dir" ) );
}
示例14: invoke
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
public RunResult invoke( Object forkTestSet )
throws TestSetFailedException
{
consoleLogger.info( "Play! initialization\n" );
initializePlayEngine();
try
{
upgradeCheck();
ReporterFactory reporterFactory = providerParameters.getReporterFactory();
RunResult runResult;
try
{
RunListener reporter = reporterFactory.createReporter();
startCapture( (ConsoleOutputReceiver) reporter );
// startCapture() called in prior to setTestsToRun()
if ( testsToRun == null )
{
setTestsToRun( forkTestSet );
}
Notifier notifier = new Notifier( new JUnit4RunListener( reporter ), getSkipAfterFailureCount() );
Result result = new Result();
notifier.addListeners( customRunListeners )
.addListener( result.createListener() );
if ( isFailFast() && commandsReader != null )
{
registerPleaseStopJUnitListener( notifier );
}
try
{
notifier.fireTestRunStarted( testsToRun.allowEagerReading()
? createTestsDescription( testsToRun )
: createDescription( UNDETERMINED_TESTS_DESCRIPTION ) );
if ( commandsReader != null )
{
registerShutdownListener( testsToRun );
commandsReader.awaitStarted();
}
for ( Class<?> testToRun : testsToRun )
{
executeTestSet( testToRun, reporter, notifier );
}
}
finally
{
notifier.fireTestRunFinished( result );
notifier.removeListeners();
}
rethrowAnyTestMechanismFailures( result );
}
finally
{
runResult = reporterFactory.close();
}
return runResult;
}
finally
{
consoleLogger.info( "Play! finalization\n" );
finalizePlayEngine();
}
}
示例15: finalizePlayEngine
import org.apache.maven.surefire.testset.TestSetFailedException; //导入依赖的package包/类
private void finalizePlayEngine()
throws TestSetFailedException
{
int playStopTimeout = Integer.parseInt( getProviderProperty( "play.stopTimeout", "0" ) );
runRunnable( new PlayStopRunnable(), "Play! finalization", playStopTimeout );
}