coO-OO-O-co opened a new issue, #11628: URL: https://github.com/apache/rocketmq/issues/11628
### Before Creating the Enhancement Request - [x] I have confirmed that this should be classified as an enhancement rather than a bug/feature. ### Summary Add focused unit tests for FutureHolder in the common module to cover cancellation of registered futures and their lifecycle across removal and re-registration. ### Motivation StatisticsItemScheduledPrinter and StatisticsItemScheduledIncrementPrinter use FutureHolder to manage scheduled tasks. FutureHolder currently has no dedicated unit tests. Tests would help detect regressions such as failing to cancel all registered futures, affecting unrelated keys, or cancelling removed futures again. ### Describe the Solution You'd Like Add FutureHolderTest using JUnit and Mockito to verify: 1. Removing a key calls cancel(false) on every future registered under that key. 2. Removing one key leaves futures under other keys unaffected and available for subsequent removal. 3. Removing an unknown key or removing the same key repeatedly does not cause additional cancellation calls. 4. Futures registered under a previously removed key can be cancelled without cancelling the old futures again. The tests use mocked futures and require no threads or sleeps. No production code changes are proposed. ### Describe Alternatives You've Considered Tests using real scheduled tasks would introduce executor management and timing dependencies. Mocked futures are sufficient to verify the cancellation calls and lifecycle behavior covered here. ### Additional Context The test implementation is ready locally. Validation: mvn -B -pl common -am clean test Results: - common module: 353 tests, 0 failures, 0 errors, 0 skipped. - FutureHolderTest: 4 tests, 0 failures, 0 errors, 0 skipped. - BUILD SUCCESS. I would like to submit a pull request for this enhancement. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
