Search in sources :

Example 1 with TestEngineStub

use of org.junit.platform.engine.test.TestEngineStub in project junit5 by junit-team.

the class DefaultLauncherTests method discoverTestPlanForEngineThatThrowsAnErrorInDiscoverPhase.

@Test
void discoverTestPlanForEngineThatThrowsAnErrorInDiscoverPhase() {
    TestEngine engine = new TestEngineStub() {

        @Override
        public TestDescriptor discover(org.junit.platform.engine.EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
            throw new Error("ignored");
        }
    };
    TestPlan testPlan = createLauncher(engine).discover(request().build());
    assertThat(testPlan.getRoots()).hasSize(0);
}
Also used : UniqueId(org.junit.platform.engine.UniqueId) DiscoverySelectors.selectUniqueId(org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId) TestPlan(org.junit.platform.launcher.TestPlan) DemoHierarchicalTestEngine(org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine) TestEngine(org.junit.platform.engine.TestEngine) EngineDiscoveryRequest(org.junit.platform.engine.EngineDiscoveryRequest) TestEngineStub(org.junit.platform.engine.test.TestEngineStub) Test(org.junit.jupiter.api.Test)

Example 2 with TestEngineStub

use of org.junit.platform.engine.test.TestEngineStub in project junit5 by junit-team.

the class DefaultLauncherTests method discoverTestPlanForEngineThatThrowsRuntimeExceptionInDiscoverPhase.

@Test
void discoverTestPlanForEngineThatThrowsRuntimeExceptionInDiscoverPhase() {
    TestEngine engine = new TestEngineStub() {

        @Override
        public TestDescriptor discover(org.junit.platform.engine.EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
            throw new RuntimeException("ignored");
        }
    };
    TestPlan testPlan = createLauncher(engine).discover(request().build());
    assertThat(testPlan.getRoots()).hasSize(0);
}
Also used : UniqueId(org.junit.platform.engine.UniqueId) DiscoverySelectors.selectUniqueId(org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId) TestPlan(org.junit.platform.launcher.TestPlan) DemoHierarchicalTestEngine(org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine) TestEngine(org.junit.platform.engine.TestEngine) EngineDiscoveryRequest(org.junit.platform.engine.EngineDiscoveryRequest) TestEngineStub(org.junit.platform.engine.test.TestEngineStub) Test(org.junit.jupiter.api.Test)

Example 3 with TestEngineStub

use of org.junit.platform.engine.test.TestEngineStub in project junit5 by junit-team.

the class DefaultLauncherTests method discoverTestPlanForEngineThatReturnsNullForItsRootDescriptor.

@Test
void discoverTestPlanForEngineThatReturnsNullForItsRootDescriptor() {
    TestEngine engine = new TestEngineStub() {

        @Override
        public TestDescriptor discover(org.junit.platform.engine.EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) {
            return null;
        }
    };
    TestPlan testPlan = createLauncher(engine).discover(request().build());
    assertThat(testPlan.getRoots()).hasSize(0);
}
Also used : UniqueId(org.junit.platform.engine.UniqueId) DiscoverySelectors.selectUniqueId(org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId) TestPlan(org.junit.platform.launcher.TestPlan) DemoHierarchicalTestEngine(org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine) TestEngine(org.junit.platform.engine.TestEngine) EngineDiscoveryRequest(org.junit.platform.engine.EngineDiscoveryRequest) TestEngineStub(org.junit.platform.engine.test.TestEngineStub) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 EngineDiscoveryRequest (org.junit.platform.engine.EngineDiscoveryRequest)3 TestEngine (org.junit.platform.engine.TestEngine)3 UniqueId (org.junit.platform.engine.UniqueId)3 DiscoverySelectors.selectUniqueId (org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId)3 DemoHierarchicalTestEngine (org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine)3 TestEngineStub (org.junit.platform.engine.test.TestEngineStub)3 TestPlan (org.junit.platform.launcher.TestPlan)3