Consistent Use of BDDMockito
Mixture of plain and BDD Mockito, sometimes in the same class. Enforce with checkstyle.
This commit is contained in:
committed by
Artem Bilan
parent
c40b2b53bc
commit
73fdff5a3f
@@ -18,7 +18,7 @@ package org.springframework.amqp.rabbit.test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -67,7 +67,7 @@ public class RabbitListenerProxyTest {
|
||||
assertThat(listener).isNotNull();
|
||||
|
||||
LatchCountDownAndCallRealMethodAnswer answer = this.harness.getLatchAnswerFor("foo", 1);
|
||||
doAnswer(answer).when(listener).foo(anyString());
|
||||
willAnswer(answer).given(listener).foo(anyString());
|
||||
|
||||
this.rabbitTemplate.convertAndSend(this.queue.getName(), "foo");
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.amqp.rabbit.test.examples;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -89,7 +89,7 @@ public class ExampleRabbitListenerSpyAndCaptureTest {
|
||||
assertThat(listener).isNotNull();
|
||||
|
||||
LatchCountDownAndCallRealMethodAnswer answer = this.harness.getLatchAnswerFor("bar", 3);
|
||||
doAnswer(answer).when(listener).foo(anyString(), anyString());
|
||||
willAnswer(answer).given(listener).foo(anyString(), anyString());
|
||||
|
||||
this.rabbitTemplate.convertAndSend(this.queue2.getName(), "bar");
|
||||
this.rabbitTemplate.convertAndSend(this.queue2.getName(), "baz");
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.amqp.rabbit.test.examples;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -83,7 +83,7 @@ public class ExampleRabbitListenerSpyTest {
|
||||
assertThat(listener).isNotNull();
|
||||
|
||||
LatchCountDownAndCallRealMethodAnswer answer = this.harness.getLatchAnswerFor("bar", 2);
|
||||
doAnswer(answer).when(listener).foo(anyString(), anyString());
|
||||
willAnswer(answer).given(listener).foo(anyString(), anyString());
|
||||
|
||||
this.rabbitTemplate.convertAndSend(this.queue2.getName(), "bar");
|
||||
this.rabbitTemplate.convertAndSend(this.queue2.getName(), "baz");
|
||||
|
||||
Reference in New Issue
Block a user