-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
optimize: expand unit test coverage for the [rocketmq] module. #6927
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #6927 +/- ##
============================================
+ Coverage 52.53% 52.69% +0.15%
- Complexity 6543 6559 +16
============================================
Files 1122 1122
Lines 39858 39861 +3
Branches 4666 4666
============================================
+ Hits 20940 21005 +65
+ Misses 16924 16861 -63
- Partials 1994 1995 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
Suggest placing this PR in the test section of the change log for better classification. |
I appreciate your suggestion. I have already updated the PR. |
LGTM |
Ⅰ. Describe what this PR did
Add unit test cases to complete the unit testing objectives for the
seata-rocketmq
module.增加单元测试用例,完成 rocketmq模块的单元测试目标
Ⅱ. Does this pull request fix one issue?
fix #6506
Ⅲ. Why don't you add test cases (unit test/integration test)?
Not applicable.
不适用
Ⅳ. Describe how to verify it
Run
mvn clean test
Ⅴ. Special notes for reviews
In the
SeataMQProducer
class, there's a methoddoSendMessageInTransaction
, which calls the parent class methodsend(Message msg, long timeout)
. Since Mockito can't mock certain parent methods, the functionality has been refactored to ensure the unit test coverage exceeds 70%. The changes are as follows:SeataMQProducer
类中有个函数doSendMessageInTransaction
,里面调用了父类的函数send(Message msg, long timeout)
。因为Mockit 无法模拟父类的某些方法,为了单元测试用例覆盖率达到70%以上,进行了拆分。具体的修改为:
Before
After