本文整理汇总了Java中org.junit.internal.runners.statements.RunBefores类的典型用法代码示例。如果您正苦于以下问题:Java RunBefores类的具体用法?Java RunBefores怎么用?Java RunBefores使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RunBefores类属于org.junit.internal.runners.statements包,在下文中一共展示了RunBefores类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: withBeforeClasses
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
@Override
protected Statement withBeforeClasses(
final Statement statement ) {
// add test environment setup
try {
final Method setupMethod = GeoWaveITRunner.class.getDeclaredMethod("setup");
setupMethod.setAccessible(true);
return super.withBeforeClasses(new RunBefores(
statement,
Collections.singletonList(new FrameworkMethod(
setupMethod)),
this));
}
catch (NoSuchMethodException | SecurityException e) {
LOGGER.warn(
"Unable to find setup method",
e);
}
return super.withBeforeClasses(statement);
}
示例2: withEnvironment
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
private Statement withEnvironment(Statement statement) {
List<FrameworkMethod> environment = super.getTestClass().getAnnotatedMethods(Environment.class);
if (environment.isEmpty()) {
log.error("@Environment annotation not used for system test , {}", getTestClass().getName());
return statement;
} else {
return new RunBefores(statement, environment, null);
}
}
示例3: withBefores
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
/**
* Adds any @BeforeAll methods to be run before the normal @Before annotated methods for the first test method only.
* <p>
* {@inheritDoc}
*/
@Override
protected Statement withBefores(final FrameworkMethod method, final Object target, final Statement stmt) {
ensureInitialized();
Statement statement = super.withBefores(method, target, stmt); // NOPMD.CloseResource
if (method.equals(expectedMethods.get(0))) {
// reverse BeforeAll method order to get a 'runs top to bottom' order
final List<FrameworkMethod> befores = Lists.reverse(getTestClass().getAnnotatedMethods(BeforeAll.class));
statement = befores.isEmpty() ? statement : new RunBefores(statement, befores, target);
}
return statement;
}
示例4: withBeforeClasses
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
/**
* Returns a {@link org.junit.runners.model.Statement}: run all non-overridden {@code @BeforeClass} methods on this class
* and superclasses before executing {@code statement}; if any throws an
* Exception, stop execution and pass the exception on.
*/
protected Statement withBeforeClasses(Statement statement) {
List<FrameworkMethod> befores = getTestClass()
.getAnnotatedMethods(BeforeClass.class);
return befores.isEmpty() ? statement :
new RunBefores(statement, befores, null);
}
示例5: withBefores
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
/**
* Returns a {@link org.junit.runners.model.Statement}: run all non-overridden {@code @Before}
* methods on this class and superclasses before running {@code next}; if
* any throws an Exception, stop execution and pass the exception on.
*
* @deprecated Will be private soon: use Rules instead
*/
@Deprecated
protected Statement withBefores(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(Before.class);
return befores.isEmpty() ? statement : new RunBefores(statement,
befores, target);
}
示例6: withBefores
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
@Override
protected synchronized Statement withBefores(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> befores =
testClassFromClassLoader
.getAnnotatedMethods((Class<? extends Annotation>) beforeFromClassLoader);
return new RunBefores(statement, befores, target);
}
示例7: withBeforeClasses
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
/**
* Returns a {@link Statement}: run all non-overridden {@code @BeforeClass} methods on this class
* and superclasses before executing {@code statement}; if any throws an
* Exception, stop execution and pass the exception on.
*/
protected Statement withBeforeClasses(Statement statement) {
List<FrameworkMethod> befores= fTestClass
.getAnnotatedMethods(BeforeClass.class);
return befores.isEmpty() ? statement :
new RunBefores(statement, befores, null);
}
示例8: withBefores
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
/**
* Returns a {@link Statement}: run all non-overridden {@code @Before}
* methods on this class and superclasses before running {@code next}; if
* any throws an Exception, stop execution and pass the exception on.
*/
protected Statement withBefores(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(
Before.class);
return befores.isEmpty() ? statement : new RunBefores(statement,
befores, target);
}
示例9: withBeforeClasses
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
/**
* Returns a {@link Statement}: run all non-overridden {@code @BeforeClass} methods on this class
* and superclasses before executing {@code statement}; if any throws an
* Exception, stop execution and pass the exception on.
*/
protected Statement withBeforeClasses(Statement statement) {
List<FrameworkMethod> befores = fTestClass
.getAnnotatedMethods(BeforeClass.class);
return befores.isEmpty() ? statement :
new RunBefores(statement, befores, null);
}
示例10: withBefores
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
/**
* Returns a {@link Statement}: run all non-overridden {@code @Before}
* methods on this class and superclasses before running {@code next}; if
* any throws an Exception, stop execution and pass the exception on.
*
* @deprecated Will be private soon: use Rules instead
*/
@Deprecated
protected Statement withBefores(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(
Before.class);
return befores.isEmpty() ? statement : new RunBefores(statement,
befores, target);
}
示例11: withBefores
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
/**
* Returns a {@link Statement}: run all non-overridden {@code @Before}
* methods on this class and superclasses before running {@code next}; if
* any throws an Exception, stop execution and pass the exception on.
*
* @deprecated Will be private soon: use Rules instead
*/
@Override
protected Statement withBefores(FrameworkMethod method, Object target,
Statement statement) {
List<FrameworkMethod> befores= getTestClass().getAnnotatedMethods(
Before.class);
befores = convert(befores);
return befores.isEmpty() ? statement : new RunBefores(statement,
befores, target);
}
示例12: withBeforeClasses
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
@Override
protected Statement withBeforeClasses(Statement statement) {
List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(BeforeClass.class);
befores = convert(befores);
return befores.isEmpty() ? statement :
new RunBefores(statement, befores, null);
}
示例13: givenTestClassWithBeforeClassAnnotatedMethods_returnsRunBeforeStatement
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
@Test
public void givenTestClassWithBeforeClassAnnotatedMethods_returnsRunBeforeStatement() throws Exception {
List<FrameworkMethod> befores = Arrays.asList(method1, method2);
when(testClass.getAnnotatedMethods(BeforeClass.class)).thenReturn(befores);
Statement actual = builder.createStatement(testClass, next, description, notifier);
assertThat(actual, is(instanceOf(RunBefores.class)));
}
示例14: withBeforeClasses
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
@Override
@SneakyThrows(NoSuchMethodException.class)
protected Statement withBeforeClasses(Statement statement) {
final FrameworkMethod fm = new FrameworkMethod(XTFTestSuite.class.getDeclaredMethod("beforeSuite"));
return new RunBefores(statement, join(fm, getTestClass().getAnnotatedMethods(BeforeClass.class), true), null);
}
示例15: withBeforeClasses
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
@Override
protected Statement withBeforeClasses(Statement statement) {
Class<? extends Annotation> beforeClass = loadClassFromClassLoader(BeforeClass.class, cl);
List<FrameworkMethod> befores = testClass.getAnnotatedMethods(beforeClass);
return befores.isEmpty() ? statement : new RunBefores(statement, befores, null);
}