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

optimize: polish testing code, replace with Mockito.verify #2625

Merged
merged 5 commits into from
May 8, 2020

Conversation

chenxi-null
Copy link
Contributor

Ⅰ. Describe what this PR did

The purposes of those test cases is just to assert if the target methods whether are invoked or not.

Using Mockito.doAnswer with instrumental variables is too complex and makes code hard to read.

Replacing with Mockito.verify can make the code more clean and readable.

Ⅱ. Does this pull request fix one issue?

No

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

polish testing code

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

chenxi added 2 commits April 27, 2020 22:26
The purposes of those test cases is just to assert if the target methods whether are invoked or not.

Using `Mockito.doAnswer` with instrumental variables is too complex and makes code hard to read.

Replacing with `Mockito.verify` can make the code more clean and readable.
@codecov-io
Copy link

codecov-io commented Apr 27, 2020

Codecov Report

Merging #2625 into develop will increase coverage by 0.12%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #2625      +/-   ##
=============================================
+ Coverage      50.75%   50.87%   +0.12%     
+ Complexity      2814     2812       -2     
=============================================
  Files            557      557              
  Lines          17904    17905       +1     
  Branches        2094     2124      +30     
=============================================
+ Hits            9087     9109      +22     
- Misses          7929     7930       +1     
+ Partials         888      866      -22     
Impacted Files Coverage Δ Complexity Δ
...ta/rm/datasource/xa/AbstractDataSourceProxyXA.java 7.69% <ø> (ø) 1.00 <0.00> (ø)
...a/io/seata/rm/datasource/xa/ConnectionProxyXA.java 53.06% <0.00%> (-1.03%) 17.00% <0.00%> (-1.00%)
...o/seata/server/coordinator/DefaultCoordinator.java 54.63% <0.00%> (-0.52%) 28.00% <0.00%> (-1.00%)
...ing/annotation/GlobalTransactionalInterceptor.java 8.80% <0.00%> (-0.08%) 2.00% <0.00%> (ø%)
...a/server/storage/db/store/LogStoreDataBaseDAO.java 71.76% <0.00%> (+0.33%) 34.00% <0.00%> (ø%)
...buf/convertor/BranchRollbackResponseConvertor.java 100.00% <0.00%> (+2.94%) 3.00% <0.00%> (ø%)
...tobuf/convertor/BranchCommitResponseConvertor.java 100.00% <0.00%> (+3.03%) 3.00% <0.00%> (ø%)
...buf/convertor/GlobalRollbackResponseConvertor.java 100.00% <0.00%> (+3.22%) 3.00% <0.00%> (ø%)
...tobuf/convertor/GlobalCommitResponseConvertor.java 100.00% <0.00%> (+3.33%) 3.00% <0.00%> (ø%)
...tobuf/convertor/GlobalStatusResponseConvertor.java 100.00% <0.00%> (+3.33%) 3.00% <0.00%> (ø%)
... and 16 more

@zjinlei zjinlei requested a review from sharajava April 27, 2020 15:37
@zjinlei zjinlei added this to the 1.3.0 milestone May 2, 2020
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

Copy link
Contributor

@l81893521 l81893521 left a comment

Choose a reason for hiding this comment

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

LGTM

@l81893521 l81893521 changed the title Polish testing code, replace with Mockito.verify optimize: polish testing code, replace with Mockito.verify May 8, 2020
@l81893521 l81893521 merged commit 87a6d0d into apache:develop May 8, 2020
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.

None yet

5 participants