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

Add Duration overloads. Fixes #1815 #1818

Merged
merged 2 commits into from Nov 7, 2019
Merged

Conversation

kluever
Copy link
Contributor

@kluever kluever commented Nov 6, 2019

Add new java.time.Duration-based public APIs to Mockito, After, and Timeout and deprecate the corresponding long-based public APIs.
Plumb those Duration instances through the internals of Mockito.

@codecov-io
Copy link

codecov-io commented Nov 6, 2019

Codecov Report

Merging #1818 into release/3.x will decrease coverage by 0.04%.
The diff coverage is 84.37%.

Impacted file tree graph

@@                Coverage Diff                @@
##             release/3.x    #1818      +/-   ##
=================================================
- Coverage          86.76%   86.71%   -0.05%     
- Complexity          2490     2492       +2     
=================================================
  Files                311      311              
  Lines               6542     6549       +7     
  Branches             821      821              
=================================================
+ Hits                5676     5679       +3     
- Misses               670      674       +4     
  Partials             196      196
Impacted Files Coverage Δ Complexity Δ
...java/org/mockito/internal/exceptions/Reporter.java 93.51% <ø> (ø) 93 <0> (ø) ⬇️
src/main/java/org/mockito/Mockito.java 96.87% <100%> (+0.1%) 44 <4> (+2) ⬆️
...nternal/verification/VerificationOverTimeImpl.java 92.1% <100%> (ø) 16 <5> (ø) ⬇️
...erification/VerificationWrapperInOrderWrapper.java 100% <100%> (ø) 6 <0> (ø) ⬇️
src/main/java/org/mockito/verification/After.java 77.77% <50%> (-22.23%) 4 <2> (ø)
...rc/main/java/org/mockito/verification/Timeout.java 69.23% <60%> (-12.59%) 5 <3> (ø)
src/main/java/org/mockito/internal/util/Timer.java 86.66% <90.9%> (+0.95%) 8 <7> (ø) ⬇️

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 68bc593...1a6f4b5. Read the comment docs.

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

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

Could we have some additional integration tests that use the new timeout method? E.g. add some new tests like

@Test
public void should_verify_with_timeout() {
// when
async.runAfter(50, callMock('c'));
async.runAfter(500, callMock('c'));
// then
verify(mock, timeout(200).only()).oneArg('c');
verify(mock).oneArg('c'); //sanity check
}

src/main/java/org/mockito/Mockito.java Outdated Show resolved Hide resolved
src/main/java/org/mockito/Mockito.java Outdated Show resolved Hide resolved
src/main/java/org/mockito/internal/util/Timer.java Outdated Show resolved Hide resolved
src/main/java/org/mockito/verification/After.java Outdated Show resolved Hide resolved
@TimvdLippe TimvdLippe merged commit 9603fb2 into mockito:release/3.x Nov 7, 2019
TimvdLippe added a commit that referenced this pull request Dec 16, 2019
TimvdLippe added a commit that referenced this pull request Dec 16, 2019
pull bot pushed a commit to scope-demo/mockito that referenced this pull request Dec 16, 2019
epeee pushed a commit to epeee/mockito that referenced this pull request Jun 22, 2020
epeee pushed a commit to epeee/mockito that referenced this pull request Jun 22, 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

3 participants