Skip to content

[ISSUE #11340] test(filter): cover FilterFactory duplicate and unregister rules - #11349

Open
chennaji9 wants to merge 1 commit into
apache:developfrom
chennaji9:cnj/test-filter-factory-register
Open

chennaji9 wants to merge 1 commit into
apache:developfrom
chennaji9:cnj/test-filter-factory-register

Conversation

@chennaji9

@chennaji9 chennaji9 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #11340

Brief Description

Extends the existing FilterSpiTest with coverage of the FilterFactory registration rules that protect the broker's filter registry:

  • registering a second SPI with an already-registered type throws IllegalArgumentException and the original instance survives (no silent overwrite of e.g. the built-in SQL92 filter);
  • unRegister returns the removed filter, makes get return null, and the type becomes registerable again;
  • registering a duplicate of the built-in SQL92 filter is rejected and leaves the built-in filter functional.

Each test cleans the registry in finally so the shared factory is left as found. Test-only change; no production code touched.

How Did You Test This Change?

mvn -pl filter -Dtest=FilterSpiTest -Dsurefire.failIfNoSpecifiedTests=false test (JDK 11, PR base commit): Tests run: 5, Failures: 0, Errors: 0 (2 pre-existing + 3 new).

…unregister rules

Extend FilterSpiTest: duplicate type registration throws and keeps the
original filter, unregister returns the filter and allows re-register,
and a duplicate SQL92 built-in registration is rejected without
disturbing the built-in filter.
@codecov-commenter

codecov-commenter commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.73%. Comparing base (9ea2ccd) to head (56bba01).
⚠️ Report is 9 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11349      +/-   ##
=============================================
- Coverage      49.75%   49.73%   -0.03%     
- Complexity     14354    14365      +11     
=============================================
  Files           1390     1390              
  Lines         103246   103262      +16     
  Branches       13502    13504       +2     
=============================================
- Hits           51375    51354      -21     
- Misses         45679    45710      +31     
- Partials        6192     6198       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by github-manager-bot

Summary

Extends FilterSpiTest with coverage of FilterFactory duplicate-registration rejection and unregister rules.

Findings

  • [Info] FilterSpiTest.java:84-148 — Three well-structured tests: duplicate type rejection (original survives), unregister-then-reregister, and built-in SQL92 protection. The try/finally cleanup ensures test isolation.
  • [Info] The AnotherNothingFilter stub correctly provides a second implementation of the same type to verify the rejection path.

Suggestions

  • None. Clean test additions that fill a real coverage gap.

Automated review by github-manager-bot

@chennaji9
chennaji9 force-pushed the cnj/test-filter-factory-register branch from d23627a to 56bba01 Compare October 18, 2026 08:11
@chennaji9

Copy link
Copy Markdown
Contributor Author

Hi @RongtongJin, sorry for the ping — this PR has been open for a while without a review yet. The change is small and focused (cover FilterFactory duplicate and unregister rules), and all tests and CI pass on my side. Would you mind taking a look when you get a chance? If it looks good, merging it would be much appreciated — happy to adjust anything if needed. Thanks a lot!

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.

[Enhancement] FilterFactory duplicate-registration and unregister semantics lack tests

3 participants