Java 类org.junit.internal.runners.statements.RunAfters 实例源码
项目:geowave
文件:GeoWaveITSuiteRunner.java
@Override
protected Statement withAfterClasses(
Statement statement ) {
try {
Statement newStatement = super.withAfterClasses(statement);
final Method tearDownMethod = GeoWaveITSuiteRunner.class.getDeclaredMethod("tearDown");
tearDownMethod.setAccessible(true);
return new RunAfters(
newStatement,
Collections.singletonList(new FrameworkMethod(
tearDownMethod)),
this);
}
catch (NoSuchMethodException | SecurityException e) {
LOGGER.warn(
"Unable to find tearDown method",
e);
}
return super.withAfterClasses(statement);
}
项目:geowave
文件:GeoWaveITRunner.java
@Override
protected Statement withAfterClasses(
final Statement statement ) {
// add test environment tear down
try {
final Statement newStatement = super.withAfterClasses(statement);
final Method tearDownMethod = GeoWaveITRunner.class.getDeclaredMethod("tearDown");
tearDownMethod.setAccessible(true);
return new RunAfters(
newStatement,
Collections.singletonList(new FrameworkMethod(
tearDownMethod)),
this);
}
catch (NoSuchMethodException | SecurityException e) {
LOGGER.warn(
"Unable to find tearDown method",
e);
}
return super.withAfterClasses(statement);
}
项目:dsl-devkit
文件:ClassRunner.java
/**
* Adds any @AfterAll methods to be run after the normal @After annotated methods for the last test method only.
* <p>
* {@inheritDoc}
*/
@Override
protected Statement withAfters(final FrameworkMethod method, final Object target, final Statement stmt) {
ensureInitialized();
Statement statement = super.withAfters(method, target, stmt); // NOPMD.CloseResource
if (method.equals(Iterables.getLast(expectedMethods))) {
final List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterAll.class);
statement = afters.isEmpty() ? statement : new RunAfters(statement, afters, target);
}
return statement;
}
项目:junit-clptr
文件:ClassLoaderPerTestRunner.java
@Override
protected synchronized Statement withAfters(FrameworkMethod method, Object target, Statement statement)
{
// We now to need to search in the class from the custom loader.
//We also need to search with the annotation loaded by the custom class loader or otherwise we don't find any method.
List<FrameworkMethod> afters =
testClassFromClassLoader
.getAnnotatedMethods((Class<? extends Annotation>) afterFromClassLoader);
return new RunAfters(statement, afters, target);
}
项目:sosiefier
文件:BlockJUnit4ClassRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @After}
* methods on this class and superclasses before running {@code next}; all
* After methods are always executed: exceptions thrown by previous steps
* are combined, if necessary, with exceptions from After methods into a
* {@link MultipleFailureException}.
*/
protected Statement withAfters(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(
After.class);
return afters.isEmpty() ? statement : new RunAfters(statement, afters,
target);
}
项目:multiverse-test
文件:UnfinalizingTestRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @After}
* methods on this class and superclasses before running {@code next}; all
* After methods are always executed: exceptions thrown by previous steps
* are combined, if necessary, with exceptions from After methods into a
* {@link MultipleFailureException}.
*
* @deprecated Will be private soon: use Rules instead
*/
@Override
protected Statement withAfters(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> afters= getTestClass().getAnnotatedMethods(
After.class);
afters = convert(afters);
return afters.isEmpty() ? statement : new RunAfters(statement, afters,
target);
}
项目:multiverse-test
文件:UnfinalizingTestRunner.java
@Override
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(AfterClass.class);
afters = convert(afters);
return afters.isEmpty() ? statement :
new RunAfters(statement, afters, null);
}
项目:junit-hierarchicalcontextrunner
文件:AfterClassStatementBuilderTest.java
@Test
public void givenTestClassWithAfterClassAnnotatedMethods_returnsRunAfterStatement() throws Exception {
List<FrameworkMethod> afters = Arrays.asList(method1, method2);
when(testClass.getAnnotatedMethods(AfterClass.class)).thenReturn(afters);
Statement actual = builder.createStatement(testClass, next, description, notifier);
assertThat(actual, is(instanceOf(RunAfters.class)));
}
项目:xtf
文件:XTFTestSuite.java
@Override
@SneakyThrows(NoSuchMethodException.class)
protected Statement withAfterClasses(Statement statement) {
final FrameworkMethod fm = new FrameworkMethod(XTFTestSuite.class.getDeclaredMethod("afterSuite"));
return new RunAfters(statement, join(fm, getTestClass().getAnnotatedMethods(AfterClass.class), false), null);
}
项目:aspectj-junit-runner
文件:AspectJUnit4Runner.java
@Override
protected Statement withAfterClasses(Statement statement) {
Class<? extends Annotation> afterClass = loadClassFromClassLoader(AfterClass.class, cl);
List<FrameworkMethod> afters = testClass.getAnnotatedMethods(afterClass);
return afters.isEmpty() ? statement : new RunAfters(statement, afters, null);
}
项目:aspectj-junit-runner
文件:AspectJUnit4Runner.java
@Override
protected Statement withAfters(FrameworkMethod method, Object target, Statement statement) {
Class<? extends Annotation> after = loadClassFromClassLoader(After.class, cl);
List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(after);
return afters.isEmpty() ? statement : new RunAfters(statement, afters, target);
}
项目:components
文件:RunAftersContiPerfAdapter.java
public static RunAftersContiPerfAdapter create(RunAfters runBefores, Statement next)
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
List<FrameworkMethod> befores = ReflectionUtils.getObjectByField(runBefores, runBefores.getClass(), "afters");
Object target = ReflectionUtils.getObjectByField(runBefores, runBefores.getClass(), "target");
return new RunAftersContiPerfAdapter(next, befores, target);
}
项目:lightblue-client
文件:BeforeAfterTestRule.java
protected Statement prepareAfterClasses(TestClass extension, Statement base) {
return new RunAfters(
base, extension.getAnnotatedMethods(AfterClass.class), null);
}
项目:lightblue-client
文件:BeforeAfterTestRule.java
protected Statement prepareAfters(TestClass extension, Statement base, Object target) {
return new RunAfters(
base, extension.getAnnotatedMethods(After.class), target);
}
项目:lightblue-hibernate-ogm
文件:BeforeAfterTestRule.java
protected Statement prepareAfterClasses(TestClass extension, Statement base) {
return new RunAfters(
base, extension.getAnnotatedMethods(AfterClass.class), null);
}
项目:lightblue-hibernate-ogm
文件:BeforeAfterTestRule.java
protected Statement prepareAfters(TestClass extension, Statement base, Object target) {
return new RunAfters(
base, extension.getAnnotatedMethods(After.class), target);
}
项目:pinpoint
文件:AbstractPinpointPluginTestSuite.java
@Override
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters= getTestClass().getAnnotatedMethods(AfterPinpointPluginTest.class);
return afters.isEmpty() ? statement : new RunAfters(statement, afters, null);
}
项目:junit-hierarchicalcontextrunner
文件:AfterClassStatementBuilder.java
public Statement createStatement(final TestClass testClass, final Statement next,
final Description description, final RunNotifier notifier) {
final List<FrameworkMethod> afters = testClass.getAnnotatedMethods(AfterClass.class);
return afters.isEmpty() ? next : new RunAfters(next, afters, null);
}
项目:confit
文件:FeatureTestsRunner.java
protected Statement withSetupTeardownAfters(Object target, Statement statement) {
List<FrameworkMethod> befores = getMethods(target.getClass(), After.class);
return befores.isEmpty() ? statement : new RunAfters(statement, befores, target);
}
项目:confit
文件:FeatureTestsRunner.java
protected Statement withAfterSetupTeardownClasses(Object setupTeardown, Statement statement) {
List<FrameworkMethod> teardowns = getMethods(setupTeardown.getClass(), AfterClass.class);
return teardowns.isEmpty() ? statement : new RunAfters(statement, teardowns, null);
}
项目:parameterized-suite
文件:ParentRunnerUtil.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @AfterClass} methods on this class
* and superclasses after executing {@code statement}; all AfterClass methods are
* always executed: exceptions thrown by previous steps are combined, if
* necessary, with exceptions from AfterClass methods into a
* {@link org.junit.runners.model.MultipleFailureException}.
*
* @see ParentRunner#withAfterClasses(org.junit.runners.model.Statement)
*/
public static Statement withAfterClasses(Statement statement, TestClass testClass) {
List<FrameworkMethod> afters = testClass
.getAnnotatedMethods(AfterClass.class);
return afters.isEmpty() ? statement :
new RunAfters(statement, afters, null);
}
项目:kc-rice
文件:LoadTimeWeavableTestRunner.java
/**
* Returns a {@link org.junit.runners.model.Statement}: run all non-overridden {@code @AfterClass} methods on this class
* and superclasses before executing {@code statement}; all AfterClass methods are
* always executed: exceptions thrown by previous steps are combined, if
* necessary, with exceptions from AfterClass methods into a
* {@link org.junit.runners.model.MultipleFailureException}.
*/
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters = getTestClass()
.getAnnotatedMethods(AfterClass.class);
return afters.isEmpty() ? statement :
new RunAfters(statement, afters, null);
}
项目:kc-rice
文件:LoadTimeWeavableTestRunner.java
/**
* Returns a {@link org.junit.runners.model.Statement}: run all non-overridden {@code @After}
* methods on this class and superclasses before running {@code next}; all
* After methods are always executed: exceptions thrown by previous steps
* are combined, if necessary, with exceptions from After methods into a
* {@link org.junit.runners.model.MultipleFailureException}.
*
* @deprecated Will be private soon: use Rules instead
*/
@Deprecated
protected Statement withAfters(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(
After.class);
return afters.isEmpty() ? statement : new RunAfters(statement, afters,
target);
}
项目:j2objc
文件:ParentRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @AfterClass} methods on this class
* and superclasses before executing {@code statement}; all AfterClass methods are
* always executed: exceptions thrown by previous steps are combined, if
* necessary, with exceptions from AfterClass methods into a
* {@link MultipleFailureException}.
*/
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters= fTestClass
.getAnnotatedMethods(AfterClass.class);
return afters.isEmpty() ? statement :
new RunAfters(statement, afters, null);
}
项目:sosiefier
文件:ParentRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @AfterClass} methods on this class
* and superclasses before executing {@code statement}; all AfterClass methods are
* always executed: exceptions thrown by previous steps are combined, if
* necessary, with exceptions from AfterClass methods into a
* {@link org.junit.runners.model.MultipleFailureException}.
*/
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters = fTestClass
.getAnnotatedMethods(AfterClass.class);
return afters.isEmpty() ? statement :
new RunAfters(statement, afters, null);
}
项目:lcm
文件:BlockJUnit4ClassRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @After}
* methods on this class and superclasses before running {@code next}; all
* After methods are always executed: exceptions thrown by previous steps
* are combined, if necessary, with exceptions from After methods into a
* {@link MultipleFailureException}.
*
* @deprecated Will be private soon: use Rules instead
*/
@Deprecated
protected Statement withAfters(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(
After.class);
return afters.isEmpty() ? statement : new RunAfters(statement, afters,
target);
}
项目:lcm
文件:ParentRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @AfterClass} methods on this class
* and superclasses before executing {@code statement}; all AfterClass methods are
* always executed: exceptions thrown by previous steps are combined, if
* necessary, with exceptions from AfterClass methods into a
* {@link MultipleFailureException}.
*/
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters = fTestClass
.getAnnotatedMethods(AfterClass.class);
return afters.isEmpty() ? statement :
new RunAfters(statement, afters, null);
}
项目:rice
文件:LoadTimeWeavableTestRunner.java
/**
* Returns a {@link org.junit.runners.model.Statement}: run all non-overridden {@code @AfterClass} methods on this class
* and superclasses before executing {@code statement}; all AfterClass methods are
* always executed: exceptions thrown by previous steps are combined, if
* necessary, with exceptions from AfterClass methods into a
* {@link org.junit.runners.model.MultipleFailureException}.
*/
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters = getTestClass()
.getAnnotatedMethods(AfterClass.class);
return afters.isEmpty() ? statement :
new RunAfters(statement, afters, null);
}
项目:rice
文件:LoadTimeWeavableTestRunner.java
/**
* Returns a {@link org.junit.runners.model.Statement}: run all non-overridden {@code @After}
* methods on this class and superclasses before running {@code next}; all
* After methods are always executed: exceptions thrown by previous steps
* are combined, if necessary, with exceptions from After methods into a
* {@link org.junit.runners.model.MultipleFailureException}.
*
* @deprecated Will be private soon: use Rules instead
*/
@Deprecated
protected Statement withAfters(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(
After.class);
return afters.isEmpty() ? statement : new RunAfters(statement, afters,
target);
}
项目:junit
文件:BlockJUnit4ClassRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @After}
* methods on this class and superclasses before running {@code next}; all
* After methods are always executed: exceptions thrown by previous steps
* are combined, if necessary, with exceptions from After methods into a
* {@link MultipleFailureException}.
*
* @deprecated Will be private soon: use Rules instead
*/
@Deprecated
protected Statement withAfters(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(
After.class);
return afters.isEmpty() ? statement : new RunAfters(statement, afters,
target);
}
项目:junit
文件:ParentRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @AfterClass} methods on this class
* and superclasses before executing {@code statement}; all AfterClass methods are
* always executed: exceptions thrown by previous steps are combined, if
* necessary, with exceptions from AfterClass methods into a
* {@link MultipleFailureException}.
*/
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters = fTestClass
.getAnnotatedMethods(AfterClass.class);
return afters.isEmpty() ? statement :
new RunAfters(statement, afters, null);
}
项目:org.openntf.domino
文件:BlockJUnit4ClassRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @After}
* methods on this class and superclasses before running {@code next}; all
* After methods are always executed: exceptions thrown by previous steps
* are combined, if necessary, with exceptions from After methods into a
* {@link MultipleFailureException}.
*
* @deprecated Will be private soon: use Rules instead
*/
@Deprecated
protected Statement withAfters(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> afters = getTestClass().getAnnotatedMethods(
After.class);
return afters.isEmpty() ? statement : new RunAfters(statement, afters,
target);
}
项目:org.openntf.domino
文件:ParentRunner.java
/**
* Returns a {@link Statement}: run all non-overridden {@code @AfterClass} methods on this class
* and superclasses before executing {@code statement}; all AfterClass methods are
* always executed: exceptions thrown by previous steps are combined, if
* necessary, with exceptions from AfterClass methods into a
* {@link MultipleFailureException}.
*/
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters = fTestClass
.getAnnotatedMethods(AfterClass.class);
return afters.isEmpty() ? statement :
new RunAfters(statement, afters, null);
}