Speed up JUnit 5 support discovery process #881
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The JUnit platform API makes it necessary for ArchUnit to provide an implementation to discover test classes from the classpath (e.g. because the discovery request contains a package selector). Since ArchUnit itself is perfectly suited for this and does not demand any third party dependency we simply use the
ClassFileImporter
for this. However, so far we have used the currentArchConfiguration
of the user, which by default e.g. resolves all further dependencies from the classpath. This is unnecessary overhead and can substantially slow down the discovery process if the test classes e.g. have some framework dependencies like the Spring framework.We will now switch the
ArchConfiguration
for the discovery process so that it does not import any transitive dependencies of the discovered classes. This way the discovery process via ArchUnit should be quite fast, no matter what further dependencies the test classes have.Resolves: #546