本文整理汇总了Java中org.junit.runner.manipulation.NoTestsRemainException类的典型用法代码示例。如果您正苦于以下问题:Java NoTestsRemainException类的具体用法?Java NoTestsRemainException怎么用?Java NoTestsRemainException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NoTestsRemainException类属于org.junit.runner.manipulation包,在下文中一共展示了NoTestsRemainException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerOptOuts
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
private void registerOptOuts(final Class<? extends Graph> graphClass,
final Optional<GraphProvider.Descriptor> graphProviderDescriptor,
final TraversalEngine.Type traversalEngineType) throws InitializationError {
final Graph.OptOut[] optOuts = graphClass.getAnnotationsByType(Graph.OptOut.class);
if (optOuts != null && optOuts.length > 0) {
// validate annotation - test class and reason must be set
if (!Arrays.stream(optOuts).allMatch(ignore -> ignore.test() != null && ignore.reason() != null && !ignore.reason().isEmpty()))
throw new InitializationError("Check @IgnoreTest annotations - all must have a 'test' and 'reason' set");
try {
filter(new OptOutTestFilter(optOuts, graphProviderDescriptor, traversalEngineType));
} catch (NoTestsRemainException ex) {
throw new InitializationError(ex);
}
}
}
示例2: filter
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
@Override
public void filter(final Filter raw) throws NoTestsRemainException {
super.filter(new Filter() {
@Override
public boolean shouldRun(Description description) {
String testDisplay = StringUtils.substringBefore(description.getDisplayName(), " ");
if (testDisplay != description.getDisplayName()) {
description = Description.createTestDescription(description.getTestClass(), testDisplay);
}
return raw.shouldRun(description);
}
@Override
public String describe() {
return raw.describe();
}
});
}
示例3: filterIfRequired
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
private void filterIfRequired(final ResultCollector rc, final Runner runner) {
if (this.filter.hasSome()) {
if (!(runner instanceof Filterable)) {
LOG.warning("Not able to filter " + runner.getDescription()
+ ". Mutation may have prevented JUnit from constructing test");
return;
}
final Filterable f = (Filterable) runner;
try {
f.filter(this.filter.value());
} catch (final NoTestsRemainException e1) {
rc.notifySkipped(this.getDescription());
return;
}
}
}
示例4: runEnabledTests
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
private void runEnabledTests(RunNotifier nested) {
if (enabledTests.isEmpty()) {
return;
}
Runner runner;
try {
runner = createExecutionRunner();
} catch (Throwable t) {
runner = new CannotExecuteRunner(getDisplayName(), target, t);
}
try {
if (!disabledTests.isEmpty()) {
((Filterable) runner).filter(new Filter() {
@Override
public boolean shouldRun(Description description) {
return !disabledTests.contains(description);
}
@Override
public String describe() {
return "disabled tests";
}
});
}
} catch (NoTestsRemainException e) {
return;
}
runner.run(nested);
}
示例5: getFilter
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
public Filter getFilter() {
return new Filter() {
@Override
public boolean shouldRun(Description description) {
return Boolean.TRUE.equals(context.get(description));
}
@Override
public String describe() {
return "RTest Filter";
}
@Override
public void apply(Object child) throws NoTestsRemainException {
if(child instanceof Filterable) {
Filterable filterableChild = (Filterable) child;
filterableChild.filter(this);
}
}
};
//return Filter.matchMethodDescription(desiredDescription);
/*return new Filter() {
@Override
public boolean shouldRun(Description description) {
return (toRun.contains(description));
}
@Override
public String describe() {
return "RTest methods filter";
}
};*/
}
示例6: addFilter
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
private void addFilter(Filter filter) {
try {
filter(filter);
} catch (NoTestsRemainException ex) {
System.out.println("No tests remain exception: " + ex);
}
}
示例7: initializeFilter
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
/**
* Initializes the test filter.
*
* @param parentRunner
* the {@link ParentRunner} to initialize, must not be {@code null}
*/
public static void initializeFilter(final ParentRunner<?> parentRunner) {
try {
parentRunner.filter(INSTANCE);
} catch (NoTestsRemainException e) {
// we ignore the case where no children are left
}
}
示例8: filterByCategory
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
private void filterByCategory(Class category) throws InitializationError {
if (category != null) {
try {
final Categories.CategoryFilter categoryFilter = Categories.CategoryFilter.include(category);
filter(categoryFilter);
} catch (NoTestsRemainException e) {
throw new RuntimeException(e);
}
}
}
示例9: applyMethodFilter
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
private void applyMethodFilter() throws InitializationError {
for (Runner r : getChildren()) {
try {
if (r instanceof ParentRunner<?>) {
((ParentRunner<?>) r).filter(methodFilter);
}
} catch (NoTestsRemainException e) {
throw new InitializationError(e);
}
}
}
示例10: PowerMockJUnit4LegacyRunnerDelegateImpl
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
public PowerMockJUnit4LegacyRunnerDelegateImpl(Class<?> klass, String[] methodsToRun,
PowerMockTestListener[] listeners) throws InitializationError, NoTestsRemainException {
super(klass, new PowerMockJUnit4LegacyTestClassMethodsRunner(klass,
listeners == null ? new PowerMockTestListener[0] : listeners));
filter(new PowerMockJUnit4LegacyFilter(methodsToRun));
testCount = methodsToRun.length;
}
示例11: getRunner
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
@Override
public Runner getRunner() {
try {
Runner runner = mRequest.getRunner();
mFilter.apply(runner);
return runner;
} catch (NoTestsRemainException e) {
// don't treat filtering out all tests as an error
return new BlankRunner();
}
}
示例12: execute
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
public static Result execute(final Class<?> classOfspecToRun, final String methodName) throws InitializationError, NoTestsRemainException {
final Result testResult = new Result();
Sputnik spockRunner = new Sputnik(classOfspecToRun);
if(methodName != null && !methodName.equals("")) {
SpockSpecificationFilter filter = new SpockSpecificationFilter(spockRunner, methodName);
spockRunner.filter(filter);
}
runTest(spockRunner, testResult);
return testResult;
}
示例13: Categories
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
public Categories(Class<?> klass, RunnerBuilder builder) throws InitializationError {
super(klass, builder);
try {
Set<Class<?>> included= getIncludedCategory(klass);
Set<Class<?>> excluded= getExcludedCategory(klass);
boolean isAnyIncluded= isAnyIncluded(klass);
boolean isAnyExcluded= isAnyExcluded(klass);
filter(CategoryFilter.categoryFilter(isAnyIncluded, included, isAnyExcluded, excluded));
} catch (NoTestsRemainException e) {
throw new InitializationError(e);
}
assertNoCategorizedDescendentsOfUncategorizeableParents(getDescription());
}
示例14: getRunner
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
@Override
public Runner getRunner() {
try {
Runner runner = fRequest.getRunner();
fFilter.apply(runner);
return runner;
} catch (NoTestsRemainException e) {
return new ErrorReportingRunner(Filter.class, new Exception(String
.format("No tests found matching %s from %s", fFilter
.describe(), fRequest.toString())));
}
}
示例15: categoryFilterLeavesOnlyMatchingMethods
import org.junit.runner.manipulation.NoTestsRemainException; //导入依赖的package包/类
@Test
public void categoryFilterLeavesOnlyMatchingMethods()
throws InitializationError, NoTestsRemainException {
CategoryFilter filter = CategoryFilter.include(SlowTests.class);
BlockJUnit4ClassRunner runner = new BlockJUnit4ClassRunner(A.class);
filter.apply(runner);
assertEquals(1, runner.testCount());
}