Repository navigation
Use more JUnit 5 features and simplify tests - #545
Merged
Merged
Conversation
- Use @nested, @DisplayName, @ParameterizedTest (@CsvSource, @valuesource), assertAll and @tempdir across the API, C#, Eclipse and javac tests - Drop duplicate assertions, dead Hamcrest comments and map/file boilerplate - Share the localized-header argument source between the javac test classes - Remove the redundant empty-array branch in AbstractCompiler.getSourceFiles()
slachiewicz
force-pushed
the
junit5-test-modernization
branch
from
November 18, 2026 20:34
128e08a to
4e6db70
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Reviewing the test suite for simplifications showed it was already on JUnit 5 Jupiter, but still carried JUnit 3-era style and a fair amount of boilerplate. This PR deepens the JUnit 5 usage and trims the noise; behaviour is unchanged.
JUnit 5 features
@Nested+@DisplayNamegroup the 13 C# argument-normalization cases.@ParameterizedTestwith@ValueSourcemerges the two identical Zip-Slip tests, and with@CsvSourcereplaces hand-written tables for javac version parsing.assertAll(withExecutablelists) reports every mismatch in a group at once.@TempDirfield injection,assertThrowsmethod references, package-private test methods.Simplifications
args(...)/assertArguments(...)andwriteFile(file, lastModified)helpers remove repeated map/file setup.localizedHeaders(...)source replaces four identical seven-row@MethodSourcebuilders shared byErrorMessageParserTestandJavacCompilerTest.AbstractCompiler.getSourceFiles()no longer special-cases the empty set beforetoArray.junit-jupiter-paramsadded as a test dependency of the C# module (version from the parent's junit-bom).Verification
mvn -o test: 206 tests, 0 failures/errors; per-class test counts preserved.spotless:check: clean.Note: builds need JDK 21 or older - palantir-java-format 2.80.0 crashes on JDK 27 with
NoSuchFieldError: endPositions.