本文整理了Java中org.junit.runner.Request.filterWith
方法的一些代码示例,展示了Request.filterWith
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.filterWith
方法的具体详情如下:
包路径:org.junit.runner.Request
类名称:Request
方法名:filterWith
[英]Returns a Request that only runs contains tests whose Descriptionequals desiredDescription
[中]返回一个仅运行其DescriptionequalsdesiredDescription
的测试的请求
代码示例来源:origin: google/j2objc
/**
* Returns a Request that only runs contains tests whose {@link Description}
* equals <code>desiredDescription</code>
*
* @param desiredDescription {@link Description} of those tests that should be run
* @return the filtered Request
*/
public Request filterWith(final Description desiredDescription) {
return filterWith(Filter.matchMethodDescription(desiredDescription));
}
代码示例来源:origin: junit-team/junit4
/**
* Returns a Request that only runs tests whose {@link Description}
* matches the given description.
*
* <p>Returns an empty {@code Request} if {@code desiredDescription} is not a single test and filters all but the single
* test if {@code desiredDescription} is a single test.</p>
*
* @param desiredDescription {@code Description} of those tests that should be run
* @return the filtered Request
*/
public Request filterWith(Description desiredDescription) {
return filterWith(Filter.matchMethodDescription(desiredDescription));
}
代码示例来源:origin: junit-team/junit4
private Request applyFilterSpecs(Request request) {
try {
for (String filterSpec : filterSpecs) {
Filter filter = FilterFactories.createFilterFromFilterSpec(
request, filterSpec);
request = request.filterWith(filter);
}
return request;
} catch (FilterNotCreatedException e) {
return errorReport(e);
}
}
代码示例来源:origin: junit-team/junit4
/**
* Create a <code>Request</code> that, when processed, will run a single test.
* This is done by filtering out all other tests. This method is used to support rerunning
* single tests.
*
* @param clazz the class of the test
* @param methodName the name of the test
* @return a <code>Request</code> that will cause a single test be run
*/
public static Request method(Class<?> clazz, String methodName) {
Description method = Description.createTestDescription(clazz, methodName);
return Request.aClass(clazz).filterWith(method);
}
代码示例来源:origin: google/j2objc
/**
* Create a <code>Request</code> that, when processed, will run a single test.
* This is done by filtering out all other tests. This method is used to support rerunning
* single tests.
*
* @param clazz the class of the test
* @param methodName the name of the test
* @return a <code>Request</code> that will cause a single test be run
*/
public static Request method(Class<?> clazz, String methodName) {
Description method = Description.createTestDescription(clazz, methodName);
return Request.aClass(clazz).filterWith(method);
}
代码示例来源:origin: org.junit.vintage/junit-vintage-engine
private RunnerTestDescriptor determineRunnerTestDescriptor(Class<?> testClass, Runner runner,
List<RunnerTestDescriptorAwareFilter> filters, UniqueId engineId) {
RunnerTestDescriptor runnerTestDescriptor = createCompleteRunnerTestDescriptor(testClass, runner, engineId);
if (!filters.isEmpty()) {
if (runner instanceof Filterable) {
Filter filter = createOrFilter(filters, runnerTestDescriptor);
Runner filteredRunner = runnerTestDescriptor.toRequest().filterWith(filter).getRunner();
runnerTestDescriptor = createCompleteRunnerTestDescriptor(testClass, filteredRunner, engineId);
}
else {
Runner runnerToReport = (runner instanceof RunnerDecorator)
? ((RunnerDecorator) runner).getDecoratedRunner()
: runner;
logger.warn(() -> "Runner " + runnerToReport.getClass().getName() //
+ " (used on " + testClass.getName() + ") does not support filtering" //
+ " and will therefore be run completely.");
}
}
return runnerTestDescriptor;
}
代码示例来源:origin: org.testng/testng
core.addListener(new RL());
Request r = Request.aClass(testCase);
return core.run(r.filterWith(new Filter() {
代码示例来源:origin: cbeust/testng
Request r = Request.aClass(testCase);
return core.run(
r.filterWith(
new Filter() {
代码示例来源:origin: apache/geode
@Test
public void testWorkingCategoryAndParameterized() {
Request request = Request.aClass(WorkingCategoryClass.class);
ExposedParameterized runner = (ExposedParameterized) request.getRunner();
request =
request.filterWith(new CategoryFilter((ExposedGetAnnotations) runner.getChildren().get(0)));
Result result = new JUnitCore().run(request);
assertEquals(2, result.getRunCount());
}
代码示例来源:origin: apache/geode
@Test
public void testBrokenCategoryAndParameterized() {
Request request = Request.aClass(BrokenCategoryClass.class);
ExposedParameterized runner = (ExposedParameterized) request.getRunner();
request = request.filterWith(new CategoryFilter(
(ExposedBlockJUnit4ClassRunnerWithParameters) runner.getChildren().get(0)));
Result result = new JUnitCore().run(request);
assertEquals(
"Yeah!! This might actually mean we've upgraded to JUnit 4.13. Hurry up already and delete this hack.",
1, result.getRunCount());
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a Request that only runs contains tests whose {@link Description}
* equals <code>desiredDescription</code>
*
* @param desiredDescription {@link Description} of those tests that should be run
* @return the filtered Request
*/
public Request filterWith(final Description desiredDescription) {
return filterWith(Filter.matchMethodDescription(desiredDescription));
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Create a <code>Request</code> that, when processed, will run a single test.
* This is done by filtering out all other tests. This method is used to support rerunning
* single tests.
*
* @param clazz the class of the test
* @param methodName the name of the test
* @return a <code>Request</code> that will cause a single test be run
*/
public static Request method(Class<?> clazz, String methodName) {
Description method = Description.createTestDescription(clazz, methodName);
return Request.aClass(clazz).filterWith(method);
}
代码示例来源:origin: stackoverflow.com
Request request = ...
Categories.CategoryFilter filter =
Categories.CategoryFilter.include(
testutils.SlowTests.class);
request = request.filterWith(filter);
Result result = JUnitCore.run(request);
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Returns a Request that only runs contains tests whose {@link Description}
* equals <code>desiredDescription</code>
*
* @param desiredDescription {@link Description} of those tests that should be run
* @return the filtered Request
*/
public Request filterWith(final Description desiredDescription) {
return filterWith(Filter.matchMethodDescription(desiredDescription));
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.junit
/**
* Returns a Request that only runs contains tests whose {@link Description}
* equals <code>desiredDescription</code>
*
* @param desiredDescription {@link Description} of those tests that should be run
* @return the filtered Request
*/
public Request filterWith(final Description desiredDescription) {
return filterWith(Filter.matchMethodDescription(desiredDescription));
}
代码示例来源:origin: org.junit/com.springsource.org.junit
/**
* Returns a Request that only runs contains tests whose {@link Description}
* equals <code>desiredDescription</code>
*
* @param desiredDescription {@link Description} of those tests that should be run
* @return the filtered Request
*/
public Request filterWith(final Description desiredDescription) {
return filterWith(Filter.matchMethodDescription(desiredDescription));
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
private Request applyFilterSpecs(Request request) {
try {
for (String filterSpec : filterSpecs) {
Filter filter = FilterFactories.createFilterFromFilterSpec(
request, filterSpec);
request = request.filterWith(filter);
}
return request;
} catch (FilterNotCreatedException e) {
return errorReport(e);
}
}
代码示例来源:origin: dakusui/jcunit
private JUnit4Runner(Class clazz, String methodName, int startInclusive, int endExclusive) {
this.request = Request.classes(clazz).filterWith(
createFilter(methodName, startInclusive, endExclusive)
);
}
代码示例来源:origin: com.oracle/truffle-tck
/**
* Create a <code>Request</code> that, when processed, will run a single test.
* This is done by filtering out all other tests. This method is used to support rerunning
* single tests.
*
* @param clazz the class of the test
* @param methodName the name of the test
* @return a <code>Request</code> that will cause a single test be run
*/
public static Request method(Class<?> clazz, String methodName) {
Description method = Description.createTestDescription(clazz, methodName);
return Request.aClass(clazz).filterWith(method);
}
代码示例来源:origin: infinitest/infinitest
private Request junitTestsToRunFrom(Class<?> classUnderTest) {
if (isJUnit3TestCaseWithWarnings(classUnderTest)) {
return new UninstantiableJUnit3TestRequest(classUnderTest);
}
Request request = Request.classWithoutSuiteMethod(classUnderTest);
Class<?>[] junitCategoriesToExclude = readExcludedGroupsFromConfiguration();
CategoryFilter excludeCategoriesFilter = CategoryFilter.exclude(junitCategoriesToExclude);
return request.filterWith(excludeCategoriesFilter);
}
内容来源于网络,如有侵权,请联系作者删除!