Java 类org.junit.runner.manipulation.Filterable 实例源码
项目:pitest
文件:AdaptedJUnitTestUnit.java
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;
}
}
}
项目:pitest
文件:JUnitCustomRunnerTestUnitFinder.java
@Override
public List<TestUnit> findTestUnits(final Class<?> clazz) {
final Runner runner = AdaptedJUnitTestUnit.createRunner(clazz);
if (isExcluded(runner) || isNotARunnableTest(runner, clazz.getName()) || !isIncluded(clazz)) {
return Collections.emptyList();
}
if (Filterable.class.isAssignableFrom(runner.getClass())
&& !shouldTreatAsOneUnit(clazz, runner)) {
List<TestUnit> filteredUnits = splitIntoFilteredUnits(runner.getDescription());
return filterUnitsByMethod(filteredUnits);
} else {
return Collections.<TestUnit> singletonList(new AdaptedJUnitTestUnit(
clazz, Option.<Filter> none()));
}
}
项目:Reer
文件:AbstractMultiTestRunner.java
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);
}
项目:rtest
文件:FilterData.java
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";
}
};*/
}
项目:Pushjet-Android
文件:AbstractMultiTestRunner.java
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);
}
项目:Pushjet-Android
文件:AbstractMultiTestRunner.java
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);
}
项目:sosiefier
文件:SingleMethodTest.java
@Test(expected = NoTestsRemainException.class)
public void filteringAwayEverythingThrowsException() throws NoTestsRemainException {
Filterable runner = (Filterable) Request.aClass(OneTimeSetup.class).getRunner();
runner.filter(new Filter() {
@Override
public boolean shouldRun(Description description) {
return false;
}
@Override
public String describe() {
return null;
}
});
}
项目:junit
文件:SingleMethodTest.java
@Test(expected = NoTestsRemainException.class)
public void filteringAwayEverythingThrowsException() throws NoTestsRemainException {
Filterable runner = (Filterable) Request.aClass(OneTimeSetup.class).getRunner();
runner.filter(new Filter() {
@Override
public boolean shouldRun(Description description) {
return false;
}
@Override
public String describe() {
return null;
}
});
}
项目:health-and-care-developer-network
文件:SingleMethodTest.java
@Test(expected = NoTestsRemainException.class)
public void filteringAwayEverythingThrowsException() throws NoTestsRemainException {
Filterable runner = (Filterable) Request.aClass(OneTimeSetup.class).getRunner();
runner.filter(new Filter() {
@Override
public boolean shouldRun(Description description) {
return false;
}
@Override
public String describe() {
return null;
}
});
}