本文整理汇总了Java中org.junit.internal.runners.statements.RunBefores类的典型用法代码示例。如果您正苦于以下问题:Java RunBefores类的具体用法?Java RunBefores怎么用?Java RunBefores使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RunBefores类属于org.junit.internal.runners.statements包,在下文中一共展示了RunBefores类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:locationtech,项目名称:geowave,代码行数:22,代码来源:GeoWaveITRunner.java
示例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);
}
}
开发者ID:pravega,项目名称:pravega,代码行数:10,代码来源:SystemTestRunner.java
示例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;
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:17,代码来源:ClassRunner.java
示例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);
}
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:LoadTimeWeavableTestRunner.java
示例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);
}
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:LoadTimeWeavableTestRunner.java
示例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);
}
开发者ID:bitstrings,项目名称:junit-clptr,代码行数:12,代码来源:ClassLoaderPerTestRunner.java
示例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);
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:12,代码来源:ParentRunner.java
示例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);
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:13,代码来源:BlockJUnit4ClassRunner.java
示例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);
}
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:12,代码来源:ParentRunner.java
示例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);
}
开发者ID:lcm-proj,项目名称:lcm,代码行数:16,代码来源:BlockJUnit4ClassRunner.java
示例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);
}
开发者ID:lithiumtech,项目名称:multiverse-test,代码行数:17,代码来源:UnfinalizingTestRunner.java
示例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);
}
开发者ID:lithiumtech,项目名称:multiverse-test,代码行数:8,代码来源:UnfinalizingTestRunner.java
示例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)));
}
开发者ID:bechte,项目名称:junit-hierarchicalcontextrunner,代码行数:9,代码来源:BeforeClassStatementBuilderTest.java
示例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);
}
开发者ID:xtf-cz,项目名称:xtf,代码行数:7,代码来源:XTFTestSuite.java
示例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);
}
开发者ID:david-888,项目名称:aspectj-junit-runner,代码行数:7,代码来源:AspectJUnit4Runner.java
示例16: withBefores
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
@Override
protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) {
Class<? extends Annotation> before = loadClassFromClassLoader(Before.class, cl);
List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(before);
return befores.isEmpty() ? statement : new RunBefores(statement, befores, target);
}
开发者ID:david-888,项目名称:aspectj-junit-runner,代码行数:7,代码来源:AspectJUnit4Runner.java
示例17: getTestRules
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
/**
* Manages CDI-Contexts to be started before entering end stopped after exiting a Statement.
* Additionally it is aware of the DatabaseAware, DatabaseUnaware and BeforeDatabaseAware annotations.
* It creates an EntityManagerFactory before entering the test method and closes it after exiting
* to always have a clean state of the database.
*/
@Override
protected List<TestRule> getTestRules(final Object target) {
List<TestRule> rules = new ArrayList<TestRule>(super.getTestRules(target));
rules.add(new TestRule() {
@Override
public Statement apply(final Statement base, final Description description) {
final DatabaseAware databaseAwareAnnotation;
if (description.getAnnotation(DatabaseUnaware.class) != null) {
databaseAwareAnnotation = null;
} else if (description.getAnnotation(DatabaseAware.class) != null) {
databaseAwareAnnotation = description.getAnnotation(DatabaseAware.class);
} else {
databaseAwareAnnotation = AnnotationUtils.findAnnotation(target.getClass(), DatabaseAware.class);
}
List<FrameworkMethod> befores = new ArrayList<FrameworkMethod>(0);
if (databaseAwareAnnotation != null) {
for (FrameworkMethod m : getTestClass().getAnnotatedMethods(BeforeDatabaseAware.class)) {
if (databaseAwareAnnotation.unitName().equals(m.getAnnotation(BeforeDatabaseAware.class).unitName())) {
befores.add(m);
}
}
}
final Statement statement = befores.isEmpty() ? base : new RunBefores(base, befores, target);
return new Statement() {
@Override
public void evaluate() throws Throwable {
EntityManagerFactory emf = null;
try {
if (databaseAwareAnnotation != null) {
Map<String, String> properties = new HashMap<String, String>();
properties.put("hibernate.hbm2ddl.auto", "create-drop");
properties.put("hibernate.ejb.entitymanager_factory_name", databaseAwareAnnotation.unitName()
+ testRun++);
emf = Persistence.createEntityManagerFactory(databaseAwareAnnotation.unitName(), properties);
}
statement.evaluate();
} catch (Throwable e) {
// We do some exception unwrapping here to get the real exception
@SuppressWarnings("unchecked")
Throwable ex = ExceptionUtils.unwrap(e, InvocationTargetException.class, EJBException.class,
TransactionRolledbackException.class);
throw ex;
} finally {
if (emf != null && emf.isOpen()) {
emf.close();
}
}
}
};
}
});
return rules;
}
开发者ID:Blazebit,项目名称:blaze-storage,代码行数:72,代码来源:DatabaseAwareArquillianRunner.java
示例18: create
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
public static RunBeforesContiPerfAdapter create(RunBefores runBefores, Statement next)
throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
List<FrameworkMethod> befores = ReflectionUtils.getObjectByField(runBefores, runBefores.getClass(), "befores");
Object target = ReflectionUtils.getObjectByField(runBefores, runBefores.getClass(), "target");
return new RunBeforesContiPerfAdapter(next, befores, target);
}
开发者ID:Talend,项目名称:components,代码行数:7,代码来源:RunBeforesContiPerfAdapter.java
示例19: prepareBeforeClasses
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
protected Statement prepareBeforeClasses(TestClass extension, Statement base) {
return new RunBefores(
base, extension.getAnnotatedMethods(BeforeClass.class), null);
}
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:5,代码来源:BeforeAfterTestRule.java
示例20: prepareBefores
import org.junit.internal.runners.statements.RunBefores; //导入依赖的package包/类
protected Statement prepareBefores(TestClass extension, Statement base, Object target) {
return new RunBefores(
base, extension.getAnnotatedMethods(Before.class), target);
}
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:5,代码来源:BeforeAfterTestRule.java
注:本文中的org.junit.internal.runners.statements.RunBefores类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论