Search in sources :

Example 1 with SelectClasspathResource

use of org.junit.platform.suite.api.SelectClasspathResource in project junit5 by junit-team.

the class SuiteLauncherDiscoveryRequestBuilderTests method selectClasspathResource.

@Test
void selectClasspathResource() {
    @SelectClasspathResource("com.example.testcases")
    class Suite {
    }
    LauncherDiscoveryRequest request = builder.suite(Suite.class).build();
    List<ClasspathResourceSelector> selectors = request.getSelectorsByType(ClasspathResourceSelector.class);
    assertEquals("com.example.testcases", exactlyOne(selectors).getClasspathResourceName());
}
Also used : LauncherDiscoveryRequest(org.junit.platform.launcher.LauncherDiscoveryRequest) ClasspathResourceSelector(org.junit.platform.engine.discovery.ClasspathResourceSelector) SelectClasspathResource(org.junit.platform.suite.api.SelectClasspathResource) Test(org.junit.jupiter.api.Test)

Example 2 with SelectClasspathResource

use of org.junit.platform.suite.api.SelectClasspathResource in project junit5 by junit-team.

the class SuiteLauncherDiscoveryRequestBuilderTests method selectClasspathResourcePosition.

@Test
void selectClasspathResourcePosition() {
    @SelectClasspathResource(value = "com.example.testcases", line = 42)
    @SelectClasspathResource(value = "com.example.testcases", line = 14, column = 15)
    class Suite {
    }
    LauncherDiscoveryRequest request = builder.suite(Suite.class).build();
    List<ClasspathResourceSelector> selectors = request.getSelectorsByType(ClasspathResourceSelector.class);
    assertEquals(Optional.of(FilePosition.from(42)), selectors.get(0).getPosition());
    assertEquals(Optional.of(FilePosition.from(14, 15)), selectors.get(1).getPosition());
}
Also used : LauncherDiscoveryRequest(org.junit.platform.launcher.LauncherDiscoveryRequest) ClasspathResourceSelector(org.junit.platform.engine.discovery.ClasspathResourceSelector) SelectClasspathResource(org.junit.platform.suite.api.SelectClasspathResource) Test(org.junit.jupiter.api.Test)

Example 3 with SelectClasspathResource

use of org.junit.platform.suite.api.SelectClasspathResource in project junit5 by junit-team.

the class SuiteLauncherDiscoveryRequestBuilderTests method ignoreClasspathResourcePosition.

@Test
void ignoreClasspathResourcePosition() {
    @SelectClasspathResource(value = "com.example.testcases", line = -1)
    @SelectClasspathResource(value = "com.example.testcases", column = 12)
    @SelectClasspathResource(value = "com.example.testcases", line = 42, column = -12)
    class Suite {
    }
    LauncherDiscoveryRequest request = builder.suite(Suite.class).build();
    List<ClasspathResourceSelector> selectors = request.getSelectorsByType(ClasspathResourceSelector.class);
    assertEquals(Optional.empty(), selectors.get(0).getPosition());
    assertEquals(Optional.empty(), selectors.get(1).getPosition());
    assertEquals(Optional.of(FilePosition.from(42)), selectors.get(2).getPosition());
}
Also used : LauncherDiscoveryRequest(org.junit.platform.launcher.LauncherDiscoveryRequest) ClasspathResourceSelector(org.junit.platform.engine.discovery.ClasspathResourceSelector) SelectClasspathResource(org.junit.platform.suite.api.SelectClasspathResource) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 ClasspathResourceSelector (org.junit.platform.engine.discovery.ClasspathResourceSelector)3 LauncherDiscoveryRequest (org.junit.platform.launcher.LauncherDiscoveryRequest)3 SelectClasspathResource (org.junit.platform.suite.api.SelectClasspathResource)3