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

fix #195 add context unit test #488

Closed

Conversation

github-ygy
Copy link
Contributor

Ⅰ. Describe what this PR did

add unit test

Ⅱ. Does this pull request fix one issue?

fix #195

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Feb 28, 2019

Codecov Report

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

Impacted file tree graph

@@             Coverage Diff              @@
##             develop     #488     +/-   ##
============================================
+ Coverage      28.01%   28.32%   +0.3%     
- Complexity       646      659     +13     
============================================
  Files            193      193             
  Lines           7456     7456             
  Branches         910      910             
============================================
+ Hits            2089     2112     +23     
+ Misses          5149     5123     -26     
- Partials         218      221      +3
Impacted Files Coverage Δ Complexity Δ
...alibaba/fescar/core/context/ContextCoreLoader.java 57.14% <0%> (+57.14%) 1% <0%> (+1%) ⬆️
...a/com/alibaba/fescar/core/context/RootContext.java 81.25% <0%> (+81.25%) 8% <0%> (+8%) ⬆️
...ba/fescar/core/context/ThreadLocalContextCore.java 100% <0%> (+100%) 4% <0%> (+4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f573e64...f007c19. Read the comment docs.

@slievrly slievrly self-requested a review March 4, 2019 13:15
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.

assertj?


@Test
public void testAssertNotInGlobalTransaction() {
RootContext.assertNotInGlobalTransaction();
Copy link
Member

Choose a reason for hiding this comment

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

expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this case without exception,the next one with exception

public void testAssertNotInGlobalTransactionWithException() {
RootContext.assertNotInGlobalTransaction();
RootContext.bind(DEFAULT_XID);
RootContext.assertNotInGlobalTransaction();
Copy link
Member

Choose a reason for hiding this comment

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

when the UT have finished or all UT for this class have finished, should clear RootContext。It may affect other UTs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok ,get it

@github-ygy github-ygy closed this Mar 4, 2019
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.

Test case should be added to enhance the test coverage
3 participants