Skip to content

Commit

Permalink
Fix reversed order of verify parameters (#2179)
Browse files Browse the repository at this point in the history
For consistency, the parameters of the method
`MockedStatic.verify(VerificationMode, Verification)`
have been swapped to
`MockedStatic.verify(Verification, VerificationMode)`
as this order is already used in
`Mockito.verify(T, VerificationMode)`.

Fixes: #2173

[ci maven-central-release]
  • Loading branch information
bohni committed Jan 16, 2021
1 parent 79f06ba commit 7b940bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/org/mockito/MockedStatic.java
Expand Up @@ -35,14 +35,21 @@ public interface MockedStatic<T> extends ScopedMock {
* See {@link Mockito#verify(Object)}.
*/
default void verify(Verification verification) {
verify(times(1), verification);
verify(verification, times(1));
}

/**
* See {@link Mockito#verify(Object, VerificationMode)}.
*
* @deprecated Please use {@link MockedStatic#verify(Verification, VerificationMode) instead
*/
void verify(VerificationMode mode, Verification verification);

/**
* See {@link Mockito#verify(Object, VerificationMode)}.
*/
void verify(Verification verification, VerificationMode mode);

/**
* See {@link Mockito#reset(Object[])}.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/mockito/internal/MockedStaticImpl.java
Expand Up @@ -61,6 +61,11 @@ public <S> OngoingStubbing<S> when(Verification verification) {

@Override
public void verify(VerificationMode mode, Verification verification) {
verify(verification, mode);
}

@Override
public void verify(Verification verification, VerificationMode mode) {
assertNotClosed();

MockingDetails mockingDetails = Mockito.mockingDetails(control.getType());
Expand Down

0 comments on commit 7b940bc

Please sign in to comment.