org.junit.platform.engine.Filter Java Examples

The following examples show how to use org.junit.platform.engine.Filter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JupiterRunner.java    From sbt-jupiter-interface with Apache License 2.0 6 votes vote down vote up
private Filter[] testFilters(Dispatcher dispatcher) {

            List<Filter<?>> filters = new ArrayList<>();

            if (!options.getExcludeTags().isEmpty()) {
                filters.add(excludeTags(options.getExcludeTags()));
            }

            if (!options.getIncludeTags().isEmpty()) {
                filters.add(includeTags(options.getIncludeTags()));
            }

            TestFilter.create(options.getTestFilters(), dispatcher).ifPresent(filters::add);
            GlobFilter.create(options.getGlobPatterns(), dispatcher).ifPresent(filters::add);

            return filters.toArray(new Filter[filters.size()]);
        }
 
Example #2
Source File: JunitPlatformDoer.java    From jeka with Apache License 2.0 6 votes vote down vote up
private static Filter[] getFilters(JkTestSelection testSelection) {
    List<Filter> result = new LinkedList<>();
    if (!testSelection.getIncludePatterns().isEmpty()) {
        result.add(ClassNameFilter.includeClassNamePatterns(toArray(testSelection.getIncludePatterns())));
    }
    if (!testSelection.getExcludePatterns().isEmpty()) {
        result.add(ClassNameFilter.excludeClassNamePatterns(toArray(testSelection.getExcludePatterns())));
    }
    if (!testSelection.getIncludeTags().isEmpty()) {
        result.add(TagFilter.includeTags(toArray(testSelection.getIncludeTags())));
    }
    if (!testSelection.getExcludeTags().isEmpty()) {
        result.add(TagFilter.excludeTags(toArray(testSelection.getExcludeTags())));
    }
    return result.toArray(new Filter[0]);
}
 
Example #3
Source File: ArchUnitTestEngine.java    From ArchUnit with Apache License 2.0 5 votes vote down vote up
private Predicate<JavaClass> isAllowedBy(EngineDiscoveryRequest discoveryRequest) {
    List<Predicate<String>> filters = Stream
            .concat(discoveryRequest.getFiltersByType(ClassNameFilter.class).stream(),
                    discoveryRequest.getFiltersByType(PackageNameFilter.class).stream())
            .map(Filter::toPredicate)
            .collect(toList());

    return javaClass -> filters.stream().allMatch(p -> p.test(javaClass.getName()));
}