Java 类org.junit.experimental.categories.Categories.CategoryFilter 实例源码

项目:sosiefier    文件:CategoryTest.java   
@Test
public void testCountWithExplicitFilter() throws Throwable {
    CategoryFilter include = CategoryFilter.include(SlowTests.class);
    Request baseRequest = Request.aClass(TestSuiteWithNoCategories.class);
    Result result = new JUnitCore().run(baseRequest.filterWith(include));
    assertTrue(result.wasSuccessful());
    assertEquals(2, result.getRunCount());
}
项目:sosiefier    文件:CategoryTest.java   
@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());
}
项目:sosiefier    文件:CategoryTest.java   
@Test
public void categoryFilterRejectsIncompatibleCategory()
        throws InitializationError, NoTestsRemainException {
    CategoryFilter filter = CategoryFilter.include(SlowTests.class);
    BlockJUnit4ClassRunner runner = new BlockJUnit4ClassRunner(
            OneFastOneSlow.class);
    filter.apply(runner);
    assertEquals(1, runner.testCount());
}
项目:sosiefier    文件:CategoryTest.java   
@Test
public void describeMultipleCategoryFilter() {
    CategoryFilter filter= CategoryFilter.include(FastTests.class, SlowTests.class);
    String d1= format("categories [%s, %s]", FastTests.class, SlowTests.class);
    String d2= format("categories [%s, %s]", SlowTests.class, FastTests.class);
    assertThat(filter.describe(), is(anyOf(equalTo(d1), equalTo(d2))));
}
项目:sosiefier    文件:CategoryTest.java   
@Test
@SuppressWarnings("unchecked")
public void testCountWithMultipleExcludeFilter() throws Throwable {
    Set<Class<?>> exclusions= new HashSet<Class<?>>(2);
    Collections.addAll(exclusions, SlowTests.class, FastTests.class);
    CategoryFilter exclude = CategoryFilter.categoryFilter(true, null, true, exclusions);
    Request baseRequest= Request.aClass(OneOfEach.class);
    Result result= new JUnitCore().run(baseRequest.filterWith(exclude));
    assertTrue(result.wasSuccessful());
    assertEquals(1, result.getRunCount());
}
项目:sosiefier    文件:CategoryTest.java   
@Test
public void testCountWithMultipleIncludeFilter() throws Throwable {
    CategoryFilter exclude = CategoryFilter.include(true, SlowTests.class, FastTests.class);
    Request baseRequest= Request.aClass(OneOfEach.class);
    Result result= new JUnitCore().run(baseRequest.filterWith(exclude));
    assertTrue(result.wasSuccessful());
    assertEquals(2, result.getRunCount());
}
项目:sosiefier    文件:ClassLevelMethodsWithIgnoredTestsTest.java   
@Test
public void beforeClassShouldNotRunWhenAllTestsAreFiltered() {
    Result result = new JUnitCore().run(Request.classes(
            BeforeClassWithFilteredTest.class, HasUnfilteredTest.class)
            .filterWith(CategoryFilter.exclude(FilteredTests.class)));
    analyseResult(
            result,
            "BeforeClass should not have been executed because the test method is filtered!");
}
项目:junit    文件:CategoryTest.java   
@Test
public void testCountWithExplicitFilter() throws Throwable {
    CategoryFilter include = CategoryFilter.include(SlowTests.class);
    Request baseRequest = Request.aClass(TestSuiteWithNoCategories.class);
    Result result = new JUnitCore().run(baseRequest.filterWith(include));
    assertTrue(result.wasSuccessful());
    assertEquals(2, result.getRunCount());
}
项目:junit    文件:CategoryTest.java   
@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());
}
项目:junit    文件:CategoryTest.java   
@Test
public void categoryFilterRejectsIncompatibleCategory()
        throws InitializationError, NoTestsRemainException {
    CategoryFilter filter = CategoryFilter.include(SlowTests.class);
    BlockJUnit4ClassRunner runner = new BlockJUnit4ClassRunner(
            OneFastOneSlow.class);
    filter.apply(runner);
    assertEquals(1, runner.testCount());
}
项目:health-and-care-developer-network    文件:CategoryTest.java   
@Test
public void testCountWithExplicitFilter() throws Throwable {
    CategoryFilter include = CategoryFilter.include(SlowTests.class);
    Request baseRequest = Request.aClass(TestSuiteWithNoCategories.class);
    Result result = new JUnitCore().run(baseRequest.filterWith(include));
    assertTrue(result.wasSuccessful());
    assertEquals(2, result.getRunCount());
}
项目:health-and-care-developer-network    文件:CategoryTest.java   
@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());
}
项目:health-and-care-developer-network    文件:CategoryTest.java   
@Test
public void categoryFilterRejectsIncompatibleCategory()
        throws InitializationError, NoTestsRemainException {
    CategoryFilter filter = CategoryFilter.include(SlowTests.class);
    BlockJUnit4ClassRunner runner = new BlockJUnit4ClassRunner(
            OneFastOneSlow.class);
    filter.apply(runner);
    assertEquals(1, runner.testCount());
}
项目:sosiefier    文件:CategoryTest.java   
@Test
public void describeACategoryFilter() {
    CategoryFilter filter = CategoryFilter.include(SlowTests.class);
    assertEquals("categories [" + SlowTests.class + "]", filter.describe());
}
项目:junit    文件:CategoryTest.java   
@Test
public void describeACategoryFilter() {
    CategoryFilter filter = CategoryFilter.include(SlowTests.class);
    assertEquals("category " + SlowTests.class, filter.describe());
}
项目:health-and-care-developer-network    文件:CategoryTest.java   
@Test
public void describeACategoryFilter() {
    CategoryFilter filter = CategoryFilter.include(SlowTests.class);
    assertEquals("category " + SlowTests.class, filter.describe());
}