Skip to content

Commit

Permalink
TestsShouldIncludeAssertions: Allow more Mockito.verify*() methods
Browse files Browse the repository at this point in the history
Fixes: #402
  • Loading branch information
knutwannheden committed Aug 25, 2023
1 parent 33422a9 commit 6a8a111
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public class TestsShouldIncludeAssertions extends Recipe {
"org.junit.jupiter.api.Assertions",
"org.hamcrest.MatcherAssert",
"org.mockito.Mockito.verify",
"org.mockito.Mockito.verifyNoInteractions",
"org.mockito.Mockito.verifyNoMoreInteractions",
"org.mockito.Mockito.verifyZeroInteractions",
"org.easymock",
"org.jmock",
"mockit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,35 @@ public void verifyTest() {
);
}

@Test
void hasMockitoVerifyNoInteractions() {
//language=java
rewriteRun(
java(
"""
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import static org.mockito.Mockito.*;
class AaTest {
@Mock
org.learning.math.MyMathService myMathService;
@Test
public void noMore() {
verifyNoMoreInteractions(myMathService);
}
@Test
public void zero() {
verifyZeroInteractions(myMathService);
}
}
"""
)
);
}

@Test
void hasMockitoDoesNotValidate() {
//language=java
Expand Down

0 comments on commit 6a8a111

Please sign in to comment.