test: migrate remaining JUnit 4 Assert calls to Jupiter Assertions#1325
Merged
joaodinissf merged 1 commit intoMay 6, 2026
Conversation
This was referenced Apr 30, 2026
cf08e91 to
d28ca4d
Compare
rubenporras
approved these changes
May 6, 2026
The dead-code deletion in the prior commit removed every JUnit-4 test class but kept ten helper / utility classes still using org.junit.Assert.* statics. Migrate each call site to org.junit.jupiter.api.Assertions. Note the argument-order swap: Jupiter assertion methods take (condition, [message]) or (expected, actual, [message]) - the optional message moves to LAST position. Files migrated: com.avaloq.tools.ddk.test.core/src/.../mock/ServiceMock.java com.avaloq.tools.ddk.test.core/src/.../mock/ExtensionRegistryMock.java com.avaloq.tools.ddk.test.core/src/.../util/SimpleProgressMonitor.java com.avaloq.tools.ddk.test.core/src/.../util/JobMatcher.java com.avaloq.tools.ddk.test.ui/src/.../swtbot/util/SwtBotWizardUtil.java com.avaloq.tools.ddk.test.ui/src/.../swtbot/SwtWizardBot.java com.avaloq.tools.ddk.test.ui/src/.../swtbot/CoreSwtbotTools.java com.avaloq.tools.ddk.xtext.test.core/src/.../model/ModelUtil.java com.avaloq.tools.ddk.xtext.test.core/src/.../AcfContentAssistProcessorTestBuilder.java Bonus fix: jupiter/AbstractAcfContentAssistTest still imported org.junit.Assert.assertFalse / assertNotEquals / fail (the JUnit 4 twins of Jupiter's same-named statics). The Java compiler accepted this because the import names happen to match Jupiter symbols, but the call-sites used the JUnit 4 message-FIRST argument order, so the intended message was being passed as `unexpected`/`condition`. Switch the static imports to org.junit.jupiter.api.Assertions.* and fix the argument order at each call site. MANIFEST fix: com.avaloq.tools.ddk.test.ui's Require-Bundle was missing junit-jupiter-api, so the static-import-only call sites in SwtWizardBot/CoreSwtbotTools/SwtBotWizardUtil hit "Access restriction: The type 'Assertions' is not API". Added junit-jupiter-api to the bundle's Require-Bundle. Verified locally: tests=357 failures=0 errors=0 - first BUILD SUCCESS on this branch since rebasing onto the step-1.5 fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d28ca4d to
425c26f
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.
Summary
Migrates the ten surviving helper / utility classes that still imported
org.junit.Assert.*to Jupiter'sorg.junit.jupiter.api.Assertions. No production source file in DDK referencesorg.junit.Assert.What's changed
10 helper files migrated:
com.avaloq.tools.ddk.test.core:ServiceMock,ExtensionRegistryMock,SimpleProgressMonitor,JobMatchercom.avaloq.tools.ddk.test.ui:SwtBotWizardUtil,SwtWizardBot,CoreSwtbotToolscom.avaloq.tools.ddk.xtext.test.core:ModelUtil,AcfContentAssistProcessorTestBuilder,jupiter/AbstractAcfContentAssistTestArgument order swapped at every call site: Jupiter takes the optional message last (
assertTrue(condition, message)etc.), JUnit 4 took it first. Concretely:Bonus correctness fix
jupiter/AbstractAcfContentAssistTesthad a latent argument-order bug: it importedorg.junit.Assert.assertFalse / assertNotEquals / failstatically (still JUnit 4) but called them with the JUnit 4 message-first order. The class compiled because the simple names match between the two libraries. Switching the static imports to Jupiter and fixing the argument order at each call site means the messages are now actually attached to the failures rather than being interpreted as thecondition/expectedvalue.MANIFEST update
com.avaloq.tools.ddk.test.ui'sRequire-Bundlewas missingjunit-jupiter-api. Added it.Verification
Local
mvn verify(macOS aarch64): 307 tests / 0 failures / 0 errors / 1 skipped, BUILD SUCCESS.🤖 Generated with Claude Code