use of org.junit.platform.engine.discovery.ClassSelector in project junit5 by junit-team.
the class DiscoveryRequestCreatorTests method convertsClassSelectors.
@Test
void convertsClassSelectors() {
options.setSelectedClasses(asList("com.acme.Foo", "com.example.Bar"));
LauncherDiscoveryRequest request = convert();
List<ClassSelector> classSelectors = request.getSelectorsByType(ClassSelector.class);
assertThat(classSelectors).extracting(ClassSelector::getClassName).containsExactly("com.acme.Foo", "com.example.Bar");
}
use of org.junit.platform.engine.discovery.ClassSelector in project junit5 by junit-team.
the class TestClassWithTemplate method singleClassResolution.
@Test
void singleClassResolution() {
ClassSelector selector = selectClass(MyTestClass.class);
resolver.resolveSelectors(request().selectors(selector).build(), engineDescriptor);
assertEquals(4, engineDescriptor.getDescendants().size());
List<UniqueId> uniqueIds = uniqueIds();
assertThat(uniqueIds).contains(uniqueIdForClass(MyTestClass.class));
assertThat(uniqueIds).contains(uniqueIdForMethod(MyTestClass.class, "test1()"));
assertThat(uniqueIds).contains(uniqueIdForMethod(MyTestClass.class, "test2()"));
assertThat(uniqueIds).contains(uniqueIdForTestFactoryMethod(MyTestClass.class, "dynamicTest()"));
}
use of org.junit.platform.engine.discovery.ClassSelector in project junit5 by junit-team.
the class TestClassWithTemplate method twoClassesResolution.
@Test
void twoClassesResolution() {
ClassSelector selector1 = selectClass(MyTestClass.class);
ClassSelector selector2 = selectClass(YourTestClass.class);
resolver.resolveSelectors(request().selectors(selector1, selector2).build(), engineDescriptor);
assertEquals(7, engineDescriptor.getDescendants().size());
List<UniqueId> uniqueIds = uniqueIds();
assertThat(uniqueIds).contains(uniqueIdForClass(MyTestClass.class));
assertThat(uniqueIds).contains(uniqueIdForMethod(MyTestClass.class, "test1()"));
assertThat(uniqueIds).contains(uniqueIdForMethod(MyTestClass.class, "test2()"));
assertThat(uniqueIds).contains(uniqueIdForTestFactoryMethod(MyTestClass.class, "dynamicTest()"));
assertThat(uniqueIds).contains(uniqueIdForClass(YourTestClass.class));
assertThat(uniqueIds).contains(uniqueIdForMethod(YourTestClass.class, "test3()"));
assertThat(uniqueIds).contains(uniqueIdForMethod(YourTestClass.class, "test4()"));
}
use of org.junit.platform.engine.discovery.ClassSelector in project junit5 by junit-team.
the class TestClassWithTemplate method classResolutionOfStaticNestedClass.
@Test
void classResolutionOfStaticNestedClass() {
ClassSelector selector = selectClass(OtherTestClass.NestedTestClass.class);
resolver.resolveSelectors(request().selectors(selector).build(), engineDescriptor);
assertEquals(3, engineDescriptor.getDescendants().size());
List<UniqueId> uniqueIds = uniqueIds();
assertThat(uniqueIds).contains(uniqueIdForClass(OtherTestClass.NestedTestClass.class));
assertThat(uniqueIds).contains(uniqueIdForMethod(OtherTestClass.NestedTestClass.class, "test5()"));
assertThat(uniqueIds).contains(uniqueIdForMethod(OtherTestClass.NestedTestClass.class, "test6()"));
}
use of org.junit.platform.engine.discovery.ClassSelector in project narchy by automenta.
the class NARTestBenchmark method junit.
// @Benchmark
// @BenchmarkMode(Mode.AverageTime)
// @Fork(1)
// public void testY() {
// The.Compound.the = FastCompound.FAST_COMPOUND_BUILDER;
// // Param.SynchronousExecution_Max_CycleTime = 0.0001f;
//
// junit(testclass);
// }
static void junit(Class... testClasses) {
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request().selectors(// selectPackage("com.example.mytests"),
(ClassSelector[]) Util.map(DiscoverySelectors::selectClass, new ClassSelector[testClasses.length], testClasses)).build();
Launcher launcher = LauncherFactory.create();
// SummaryGeneratingListener listener = new SummaryGeneratingListener();
LoggingListener listener = LoggingListener.forJavaUtilLogging();
launcher.registerTestExecutionListeners(listener);
launcher.execute(request, listener);
// listener.getSummary().printTo(new PrintWriter(System.out));
}
Aggregations