Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify code that creates class stream #411

Merged
merged 1 commit into from
Aug 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import com.tngtech.archunit.Internal;
import com.tngtech.archunit.core.MayResolveTypesViaReflection;
import com.tngtech.archunit.core.domain.JavaClass;
import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ClassFileImporter;
import org.junit.platform.engine.EngineDiscoveryRequest;
import org.junit.platform.engine.ExecutionRequest;
Expand Down Expand Up @@ -143,15 +141,11 @@ private void resolveRequestedUniqueIds(EngineDiscoveryRequest discoveryRequest,
}

private Stream<JavaClass> getContainedClasses(String[] packages) {
return stream(new ClassFileImporter().importPackages(packages));
return new ClassFileImporter().importPackages(packages).stream();
}

private Stream<JavaClass> getContainedClasses(ClasspathRootSelector selector) {
return stream(new ClassFileImporter().importUrl(toUrl(selector.getClasspathRoot())));
}

private Stream<JavaClass> stream(JavaClasses classes) {
return StreamSupport.stream(classes.spliterator(), false);
return new ClassFileImporter().importUrl(toUrl(selector.getClasspathRoot())).stream();
}

private Predicate<JavaClass> isAllowedBy(EngineDiscoveryRequest discoveryRequest) {
Expand Down