本文整理汇总了Java中org.junit.internal.runners.statements.RunAfters类的典型用法代码示例。如果您正苦于以下问题:Java RunAfters类的具体用法?Java RunAfters怎么用?Java RunAfters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RunAfters类属于org.junit.internal.runners.statements包,在下文中一共展示了RunAfters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: withAfterClasses
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
@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);
}
示例2: withAfterClasses
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
@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);
}
示例3: withAfters
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
/**
* 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;
}
示例4: withAfters
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
@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);
}
示例5: withAfters
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
/**
* 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);
}
示例6: withAfters
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
/**
* 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);
}
示例7: withAfterClasses
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
@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);
}
示例8: givenTestClassWithAfterClassAnnotatedMethods_returnsRunAfterStatement
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
@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)));
}
示例9: withAfterClasses
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
@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);
}
示例10: withAfterClasses
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
@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);
}
示例11: withAfters
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
@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);
}
示例12: create
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
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);
}
示例13: prepareAfterClasses
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
protected Statement prepareAfterClasses(TestClass extension, Statement base) {
return new RunAfters(
base, extension.getAnnotatedMethods(AfterClass.class), null);
}
示例14: prepareAfters
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
protected Statement prepareAfters(TestClass extension, Statement base, Object target) {
return new RunAfters(
base, extension.getAnnotatedMethods(After.class), target);
}
示例15: withAfterClasses
import org.junit.internal.runners.statements.RunAfters; //导入依赖的package包/类
@Override
protected Statement withAfterClasses(Statement statement) {
List<FrameworkMethod> afters= getTestClass().getAnnotatedMethods(AfterPinpointPluginTest.class);
return afters.isEmpty() ? statement : new RunAfters(statement, afters, null);
}