use of org.junit.platform.engine.discovery.ClasspathResourceSelector 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());
}
use of org.junit.platform.engine.discovery.ClasspathResourceSelector 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());
}
use of org.junit.platform.engine.discovery.ClasspathResourceSelector in project junit5 by junit-team.
the class DiscoveryRequestCreatorTests method convertsClasspathResourceSelectors.
@Test
void convertsClasspathResourceSelectors() {
options.setSelectedClasspathResources(asList("foo.csv", "com/example/bar.json"));
LauncherDiscoveryRequest request = convert();
List<ClasspathResourceSelector> classpathResourceSelectors = request.getSelectorsByType(ClasspathResourceSelector.class);
assertThat(classpathResourceSelectors).extracting(ClasspathResourceSelector::getClasspathResourceName).containsExactly("foo.csv", "com/example/bar.json");
}
use of org.junit.platform.engine.discovery.ClasspathResourceSelector 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());
}
Aggregations