<commit_before>package com.github.aha.poc.junit5.tag;

import org.junit.jupiter.api.DisplayName;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.platform.suite.api.IncludeTags;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.runner.RunWith;

@RunWith(JUnitPlatform.class)
@DisplayName("Fast Suite - run all fast tests")
@SelectClasses({ATest.class, BTest.class})
@IncludeTags(TagConsts.FAST)
public class FastSuite {

}
<commit_msg>+ [ju5] discovery & filtering example (Launcher)<commit_after>package com.github.aha.poc.junit5.tag;

import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage;
import static org.junit.platform.launcher.TagFilter.includeTags;

import org.junit.platform.launcher.Launcher;
import org.junit.platform.launcher.LauncherDiscoveryRequest;
import org.junit.platform.launcher.TestIdentifier;
import org.junit.platform.launcher.TestPlan;
import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder;
import org.junit.platform.launcher.core.LauncherFactory;
import org.junit.platform.launcher.listeners.SummaryGeneratingListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class FastSuite {

	/** Logger. */
	private static final Logger LOG = LoggerFactory.getLogger(FastSuite.class);

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
				.selectors(selectPackage("com.github.aha.poc.junit5.tag"))
//				.selectors(selectClass(ATest.class), selectClass(BTest.class))
				.filters(includeTags(TagConsts.A, TagConsts.FAST))
				.build();

		Launcher launcher = LauncherFactory.create();

		// analyze test plan
		TestPlan testPlan = launcher.discover(request);
		for (TestIdentifier testIdentifier : testPlan.getRoots()) {
			LOG.info("Test plan contains {}:", testIdentifier.getUniqueId());
			for (TestIdentifier ti : testPlan.getChildren(testIdentifier)) {
				LOG.info("{}", ti.getDisplayName());
			}
		}

		// Executing tests
		SummaryGeneratingListener listener = new SummaryGeneratingListener();
		launcher.registerTestExecutionListeners(listener);
		launcher.execute(request, listener);
	}
}

{'fraction_non_alphanumeric': 0.11687170474516696, 'fraction_numerical': 0.0026362038664323375, 'mean_word_length': 4.808673469387755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3315522', 'n_tokens_mistral': 738, 'n_tokens_neox': 690, 'n_words': 114}