use of org.junit.platform.console.options.Theme in project junit5 by junit-team.
the class ConsoleTestExecutor method createDetailsPrintingListener.
private Optional<TestExecutionListener> createDetailsPrintingListener(PrintWriter out) {
boolean disableAnsiColors = options.isAnsiColorOutputDisabled();
Theme theme = options.getTheme();
switch(options.getDetails()) {
case SUMMARY:
// summary listener is always created and registered
return Optional.empty();
case FLAT:
return Optional.of(new FlatPrintingListener(out, disableAnsiColors));
case TREE:
return Optional.of(new TreePrintingListener(out, disableAnsiColors, theme));
case VERBOSE:
return Optional.of(new VerboseTreePrintingListener(out, disableAnsiColors, 16, theme));
default:
return Optional.empty();
}
}
use of org.junit.platform.console.options.Theme in project junit5 by junit-team.
the class ConsoleDetailsTests method scanContainerClassAndCreateDynamicTests.
private List<DynamicNode> scanContainerClassAndCreateDynamicTests(Class<?> containerClass) {
String containerName = containerClass.getSimpleName().replace("TestCase", "");
// String containerName = containerClass.getSimpleName();
List<DynamicNode> nodes = new ArrayList<>();
Map<Details, List<DynamicTest>> map = new EnumMap<>(Details.class);
for (Method method : findMethods(containerClass, m -> m.isAnnotationPresent(Test.class))) {
String methodName = method.getName();
Class<?>[] types = method.getParameterTypes();
for (Details details : Details.values()) {
List<DynamicTest> tests = map.computeIfAbsent(details, key -> new ArrayList<>());
for (Theme theme : Theme.values()) {
String caption = containerName + "-" + methodName + "-" + details + "-" + theme;
String[] args = { //
"--include-engine", //
"junit-jupiter", //
"--details", //
details.name(), //
"--details-theme", //
theme.name(), //
"--disable-ansi-colors", //
"true", //
"--include-classname", //
containerClass.getCanonicalName(), //
"--select-method", //
getFullyQualifiedMethodName(containerClass, methodName, types) };
String displayName = methodName + "() " + theme.name();
String dirName = "console/details/" + containerName.toLowerCase();
String outName = caption + ".out.txt";
tests.add(DynamicTest.dynamicTest(displayName, new Runner(dirName, outName, args)));
}
}
}
map.forEach((details, tests) -> nodes.add(DynamicContainer.dynamicContainer(details.name(), tests)));
return nodes;
}
Aggregations