Repository navigation
Collapse duplicate-model tests into one parameterized test - #651
Merged
Merged
Conversation
The three duplicate-model cases used identical try/catch/fail boilerplate differing only in model file and expected message. A single CsvSource-driven test keeps all three cases while making the assertions uniform and the intent easier to read.
gnodet-bot
approved these changes
Nov 18, 2026
gnodet-bot
left a comment
There was a problem hiding this comment.
LGTM. Clean consolidation — assertThrows + @CsvSource is exactly the right JUnit 5 idiom for this pattern. All three cases are preserved verbatim, the assertions are live (mutation-tested per the PR description), and there are no production-code changes.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
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.
The three duplicate-model tests repeated the same try/catch/fail boilerplate
and differed only in the model file and expected message.
junit-jupiter-paramsis already a test dependency of modello-core, so one CsvSource-driven test with
assertThrowsexpresses all three cases directly.Area: modello-core test sources only; production code is untouched.
Changes:
modelWithDuplicateClasses,modelWithDuplicateFieldsandmodelWithDuplicateAssociationswith one@ParameterizedTest/@CsvSourcemethod
modelWithDuplicateMember(modelFile, expectedMessage).assertThrows(ModelloRuntimeException.class, ...)+assertEqualsonthe message; removed the now-unused
failimport.Verification (JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home):
mvn -B -o spotless:apply/mvn -B -o spotless:check- both BUILD SUCCESSmvn -B -o test- BUILD SUCCESS, 178 tests run, 0 failures/errors/skipstest-summary.py --classesbefore/after: modello-core 73 -> 73 tests,DefaultModelloCoreTest 4 -> 4, 0 classes lost tests
failed exactly 1 of 4 tests (
Tests run: 4, Failures: 1); restored from thesaved copy. The refactored assertion is therefore live, not vacuous.