Search in sources :

Example 1 with AbstractTestDescriptor

use of org.junit.platform.engine.support.descriptor.AbstractTestDescriptor in project junit5 by junit-team.

the class TestPlanTests method doesNotContainTestsForEmptyContainers.

@Test
void doesNotContainTestsForEmptyContainers() {
    engineDescriptor.addChild(new AbstractTestDescriptor(engineDescriptor.getUniqueId().append("test", "bar"), "Bar") {

        @Override
        public Type getType() {
            return Type.CONTAINER;
        }
    });
    TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));
    assertThat(testPlan.containsTests()).as("contains tests").isFalse();
}
Also used : AbstractTestDescriptor(org.junit.platform.engine.support.descriptor.AbstractTestDescriptor) Test(org.junit.jupiter.api.Test)

Example 2 with AbstractTestDescriptor

use of org.junit.platform.engine.support.descriptor.AbstractTestDescriptor in project junit5 by junit-team.

the class TestPlanTests method containsTestsForTests.

@Test
void containsTestsForTests() {
    engineDescriptor.addChild(new AbstractTestDescriptor(engineDescriptor.getUniqueId().append("test", "bar"), "Bar") {

        @Override
        public Type getType() {
            return Type.TEST;
        }
    });
    TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));
    assertThat(testPlan.containsTests()).as("contains tests").isTrue();
}
Also used : AbstractTestDescriptor(org.junit.platform.engine.support.descriptor.AbstractTestDescriptor) Test(org.junit.jupiter.api.Test)

Example 3 with AbstractTestDescriptor

use of org.junit.platform.engine.support.descriptor.AbstractTestDescriptor in project junit5 by junit-team.

the class TestTemplateTestDescriptorTests method inheritsTagsFromParent.

@Test
void inheritsTagsFromParent() throws Exception {
    UniqueId rootUniqueId = UniqueId.root("segment", "template");
    UniqueId parentUniqueId = rootUniqueId.append("class", "myClass");
    AbstractTestDescriptor parent = containerTestDescriptorWithTags(parentUniqueId, singleton(TestTag.create("foo")));
    TestTemplateTestDescriptor testDescriptor = new TestTemplateTestDescriptor(parentUniqueId.append("tmp", "testTemplate()"), MyTestCase.class, MyTestCase.class.getDeclaredMethod("testTemplate"));
    parent.addChild(testDescriptor);
    assertThat(testDescriptor.getTags()).containsExactlyInAnyOrder(TestTag.create("foo"), TestTag.create("bar"), TestTag.create("baz"));
}
Also used : UniqueId(org.junit.platform.engine.UniqueId) AbstractTestDescriptor(org.junit.platform.engine.support.descriptor.AbstractTestDescriptor) Test(org.junit.jupiter.api.Test)

Example 4 with AbstractTestDescriptor

use of org.junit.platform.engine.support.descriptor.AbstractTestDescriptor in project junit5 by junit-team.

the class TestPlanTests method containsTestsForContainersThatMayRegisterTests.

@Test
void containsTestsForContainersThatMayRegisterTests() {
    engineDescriptor.addChild(new AbstractTestDescriptor(engineDescriptor.getUniqueId().append("test", "bar"), "Bar") {

        @Override
        public Type getType() {
            return Type.CONTAINER;
        }

        @Override
        public boolean mayRegisterTests() {
            return true;
        }
    });
    TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));
    assertThat(testPlan.containsTests()).as("contains tests").isTrue();
}
Also used : AbstractTestDescriptor(org.junit.platform.engine.support.descriptor.AbstractTestDescriptor) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)4 AbstractTestDescriptor (org.junit.platform.engine.support.descriptor.AbstractTestDescriptor)4 UniqueId (org.junit.platform.engine.UniqueId)1