Fix ExampleJupiterTests CodeNarc violations and invalid status transition - #371
Merged
ashishvijaywargiya merged 1 commit intoAug 20, 2026
Conversation
…tion Fixes trunk CI build failures from the REST API test-cases-api-support merge (apache#370): - shouldCreateExample/shouldCreateExampleWithParams now assert directly on the returned Example instead of relying solely on the private helper's asserts, satisfying CodeNarc's JUnitTestMethodWithoutAssert rule - Fixed createAndAssertExample's indentation (Indentation rule) - Moved the static exampleCreationCases() before the instance method createAndAssertExample() (StaticMethodsBeforeInstanceMethods rule) - shouldUpdateExample defaulted updatedStatusId to EXST_APPROVED, which is not a valid direct transition from EXST_IN_DESIGN per ExampleDemoData.xml's StatusValidChange rows (valid path is IN_DESIGN -> DEFINED -> APPROVED); changed the default to EXST_DEFINED so the test exercises a real transition
|
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.



Problem
Trunk CI (
ofbizTrunkFrameworkPluginsbuilder, build 1756) started failing right after the REST API test-cases-api-support merge (#370), on two independent issues inExampleJupiterTests.groovy:checkstep —codenarcTestfailed with 4 violations (2 priority-2, 2 priority-3), exceeding the allowed threshold:shouldCreateExample()/shouldCreateExampleWithParams()— flagged byJUnitTestMethodWithoutAssertbecause they only assert indirectly, through the privatecreateAndAssertExample()helpercreateAndAssertExample(...)— wrong indentation (Indentationrule)exampleCreationCases()— private static method declared after a private instance method (StaticMethodsBeforeInstanceMethodsrule)testIntegrationstep —shouldUpdateExample()asserted a directEXST_IN_DESIGN -> EXST_APPROVEDstatus update, which isn't a valid transition perExampleDemoData.xml'sStatusValidChangerows (the valid path isIN_DESIGN -> DEFINED -> APPROVED), soupdateExamplecorrectly errored and the assertion failed.Fix
shouldCreateExample()/shouldCreateExampleWithParams()on the returnedExamplecreateAndAssertExample's indentationexampleCreationCases()beforecreateAndAssertExample()shouldUpdateExample()'s defaultupdatedStatusIdfromEXST_APPROVEDtoEXST_DEFINED, a transition that's actually reachable from the default initialEXST_IN_DESIGNstatus in one callVerification
./gradlew codenarcTestpasses (previously failed with the exact violations CI reported)./gradlew compileTestGroovycompiles cleanEXST_IN_DESIGN -> EXST_DEFINEDis a valid transition by inspectingStatusValidChangeseed data inExampleDemoData.xml