Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ExcludeIf constructor and enhance test coverage #54965

Closed
wants to merge 5 commits into from

Conversation

alikhosravidev
Copy link
Contributor

@alikhosravidev alikhosravidev commented Mar 10, 2025

This PR improves the ExcludeIf class and its corresponding tests by implementing the following changes:

Refactored the ExcludeIf constructor for better readability using an early return pattern.

Improved test readability by:

  • Splitting valid and invalid condition tests into separate test methods.
  • Replacing try-catch blocks with expectException() for cleaner assertions.

Added a test case for null values to ensure ExcludeIf properly rejects them as invalid conditions.
Extended testExcludeIfRuleValidation to cover additional validation scenarios, improving test coverage.
Added a dynamic condition check in ExcludeIf rule to handle non-deterministic closures, ensuring correct behavior for dynamically evaluated conditions.

These changes enhance code clarity, maintainability, and test reliability. 🚀

@alikhosravidev alikhosravidev deleted the test/exclude-if branch March 10, 2025 17:23
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.

2 participants