File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
main/java/org/openrewrite/java/testing/cleanup
test/java/org/openrewrite/java/testing/cleanup Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ public class TestsShouldIncludeAssertions extends Recipe {
4242 "org.junit.jupiter.api.Assertions" ,
4343 "org.hamcrest.MatcherAssert" ,
4444 "org.mockito.Mockito.verify" ,
45+ "org.mockito.Mockito.verifyNoInteractions" ,
46+ "org.mockito.Mockito.verifyNoMoreInteractions" ,
47+ "org.mockito.Mockito.verifyZeroInteractions" ,
4548 "org.easymock" ,
4649 "org.jmock" ,
4750 "mockit" ,
Original file line number Diff line number Diff line change @@ -300,6 +300,35 @@ public void verifyTest() {
300300 );
301301 }
302302
303+ @ Test
304+ void hasMockitoVerifyNoInteractions () {
305+ //language=java
306+ rewriteRun (
307+ java (
308+ """
309+ import org.junit.jupiter.api.Test;
310+ import org.mockito.Mock;
311+ import static org.mockito.Mockito.*;
312+
313+ class AaTest {
314+ @Mock
315+ org.learning.math.MyMathService myMathService;
316+
317+ @Test
318+ public void noMore() {
319+ verifyNoMoreInteractions(myMathService);
320+ }
321+
322+ @Test
323+ public void zero() {
324+ verifyZeroInteractions(myMathService);
325+ }
326+ }
327+ """
328+ )
329+ );
330+ }
331+
303332 @ Test
304333 void hasMockitoDoesNotValidate () {
305334 //language=java
You can’t perform that action at this time.
0 commit comments