Skip to content

Conversation

@Md-Arif-Hasan
Copy link

Purpose

This pull request fixes a flaky test:
CaseServiceImplTest.testStartExpressionCaseWithCaseFile- which was failing intermittently due to inconsistent behavior in case data evaluation and task assignment, likely caused by non-deterministic Map ordering and timing-related behavior.

Root Cause

The test used a standard HashMap to populate case file data, which does not guarantee key order. Under different JVM executions or shuffling (e.g., NonDex), the internal structure of the case file may behave unpredictably, leading to test failures or unexpected values.

How to Reproduce the Failure

Run the test with NonDex to simulate non-determinism:

mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex \
  -Dtest=org.jbpm.casemgmt.impl.CaseServiceImplTest#testStartExpressionCaseWithCaseFile
 

Fix Summary

Used LinkedHashMap Instead of HashMap
Replaced HashMap with LinkedHashMap to preserve insertion order and ensure deterministic case file creation.

Map<String, Object> data = new LinkedHashMap<>();

No Functional Changes

  • Business logic remains unchanged. The fix improves test stability and determinism.

Validation

Local test run - ✅ Passed
NonDex run - 	✅ Passed consistently

Commands used:

mvn -Dtest=org.jbpm.casemgmt.impl.CaseServiceImplTest#testStartExpressionCaseWithCaseFile test

mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex \
  -Dtest=org.jbpm.casemgmt.impl.CaseServiceImplTest#testStartExpressionCaseWithCaseFile

Additional Notes

  • This fix improves reliability in CI environments with NonDex or parallel executions.
    
  • The test is now resilient to JVM-level data ordering variations.
    

Let me know if any further changes or reviews are needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant