-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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 the test in the package org. Apache. Dubbo. Reactive. #13175
Refactor the test in the package org. Apache. Dubbo. Reactive. #13175
Conversation
dubbo-plugin/dubbo-reactive/src/test/java/org/apache/dubbo/reactive/CreatObserverAdapter.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## 3.2 #13175 +/- ##
=========================================
Coverage 69.38% 69.39%
Complexity 2 2
=========================================
Files 1648 1648
Lines 68693 68693
Branches 10014 10014
=========================================
+ Hits 47661 47667 +6
- Misses 16438 16441 +3
+ Partials 4594 4585 -9 see 26 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
import static org.mockito.ArgumentMatchers.anyString; | ||
import static org.mockito.Mockito.doAnswer; | ||
|
||
public class CreatObserverAdapter { |
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.
Is Creat
correct? Maybe Create
?
Kudos, SonarCloud Quality Gate passed!
|
Purpose of the Change
This PR is aimed at resolving the issue of duplicated creation of mock. This occurs in five test cases in
ManyToManyMethodHandlerTest.java
,ManyToOneMethodHandlerTest.java
andOneToManyMethodHandlerTest.java
, as highlighted in issue #13154.Brief changelog
We created a reusable class
creatObserverAdapter
to create the mock, avoiding duplicate creation of the mock in 5 test cases.Since in
ManyToOneMethodHandlerTest.java
andOneToManyMethodHandlerTest.java
, the mock is both created duplicated in two test cases, we set this mock object as a class attribute and create it in@BeforeEach
.After refactoring, we removed duplicate lines of code for the following five test cases and improved readability and maintainability:
Verifying this change
Checklist