Skip to content

Conversation

@Monilnarang
Copy link
Contributor

@Monilnarang Monilnarang commented Apr 13, 2025

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Summary:

  • Parameterized testGetErrorMsgWithValidCodeReturnsExpectedMsg

Elaboration:

  • The same method calls (getMsg()) is repeated multiple times with different inputs, making the test harder to maintain and extend.
  • When a test fails, JUnit only shows which assertion failed, but not which specific input caused the failure.
  • Adding new test cases requires copying and pasting another Assertions.assertEquals(...) statement instead of simply adding new data.

To accomplish this, I have retrofitted the test into a parameterized unit test. This reduces duplication, allows easy extension by simply adding new value sets, and makes debugging easier as it clearly indicates which test failed instead of requiring a search through individual assertions.

Test execution results after changes:
Screenshot 2025-04-13 at 11 24 21 AM

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Successful tests run

Ⅴ. Special notes for reviews

@Monilnarang Monilnarang changed the title Refactored testGetErrorMsgWithValidCodeReturnsExpectedMsg to use parameterized unit testing test: Refactored testGetErrorMsgWithValidCodeReturnsExpectedMsg to use parameterized unit testing Apr 13, 2025
@codecov
Copy link

codecov bot commented Apr 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.18%. Comparing base (1619528) to head (30d31f5).
Report is 1 commits behind head on 2.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7287      +/-   ##
============================================
- Coverage     54.23%   54.18%   -0.06%     
+ Complexity     7266     7263       -3     
============================================
  Files          1178     1178              
  Lines         41961    41961              
  Branches       4923     4923              
============================================
- Hits          22758    22735      -23     
- Misses        17051    17076      +25     
+ Partials       2152     2150       -2     

see 3 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

LGTM

@slievrly slievrly merged commit c1d5d24 into apache:2.x Apr 22, 2025
8 of 9 checks passed
@slievrly slievrly added this to the 2.5.0 milestone Apr 22, 2025
slievrly pushed a commit to slievrly/fescar that referenced this pull request Oct 21, 2025
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
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