Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit a1a3084

Browse files
committed
Bump test dependencies: Mockito 2.23.4, JUnit 5.3.2
1 parent b79bf22 commit a1a3084

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

build.gradle

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ ext {
4242
rabbitMqJavaClientVersion = '5.5.1'
4343

4444
// Testing
45-
mockitoVersion = '1.10.19'
46-
awaitilityVersion = '3.1.0'
47-
junitPlatformVersion = '1.3.1'
48-
junitJupiterVersion = '5.3.1'
45+
mockitoVersion = '2.23.4'
46+
junitPlatformVersion = '1.3.2'
47+
junitJupiterVersion = '5.3.2'
4948

5049
javadocLinks = ["http://docs.oracle.com/javase/7/docs/api/",
5150
"http://docs.oracle.com/javaee/6/api/",
@@ -174,8 +173,7 @@ configure(allprojects) { project ->
174173
testRuntime("org.junit.platform:junit-platform-launcher:${junitPlatformVersion}")
175174

176175
testCompile "io.projectreactor:reactor-test:$reactorCoreVersion"
177-
testCompile "org.awaitility:awaitility:$awaitilityVersion",
178-
"org.mockito:mockito-core:$mockitoVersion"
176+
testCompile "org.mockito:mockito-core:$mockitoVersion"
179177
testRuntime "org.slf4j:jcl-over-slf4j:$slf4jVersion"
180178
testRuntime "org.slf4j:slf4j-api:$slf4jVersion"
181179
testRuntime "ch.qos.logback:logback-classic:$logbackVersion"

src/test/java/reactor/rabbitmq/ConnectionRecoveryTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
import static java.time.Duration.ofMillis;
5959
import static java.time.Duration.ofSeconds;
6060
import static org.junit.jupiter.api.Assertions.*;
61-
import static org.mockito.Matchers.any;
62-
import static org.mockito.Matchers.anyBoolean;
63-
import static org.mockito.Matchers.anyLong;
64-
import static org.mockito.Matchers.anyString;
61+
import static org.mockito.ArgumentMatchers.any;
62+
import static org.mockito.ArgumentMatchers.anyBoolean;
63+
import static org.mockito.ArgumentMatchers.anyLong;
64+
import static org.mockito.ArgumentMatchers.anyString;
6565
import static org.mockito.Mockito.doAnswer;
6666
import static org.mockito.Mockito.mock;
6767
import static org.mockito.Mockito.when;
@@ -182,7 +182,7 @@ void consumeAutoAckRetryOnAck() throws Exception {
182182
when(mockChannel.basicConsume(
183183
anyString(), anyBoolean(), any(DeliverCallback.class), any(CancelCallback.class)
184184
)).thenAnswer(answer -> {
185-
deliverCallbackAtomicReference.set(answer.getArgumentAt(2, DeliverCallback.class));
185+
deliverCallbackAtomicReference.set(answer.getArgument(2));
186186
consumerRegisteredLatch.countDown();
187187
return "ctag";
188188
});
@@ -240,7 +240,7 @@ void consumeManualAckRetryOnAck() throws Exception {
240240
when(mockChannel.basicConsume(
241241
anyString(), anyBoolean(), any(DeliverCallback.class), any(CancelCallback.class)
242242
)).thenAnswer(answer -> {
243-
deliverCallbackAtomicReference.set(answer.getArgumentAt(2, DeliverCallback.class));
243+
deliverCallbackAtomicReference.set(answer.getArgument(2));
244244
consumerRegisteredLatch.countDown();
245245
return "ctag";
246246
});

src/test/java/reactor/rabbitmq/RabbitFluxTests.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555

5656
import static org.junit.jupiter.api.Assertions.*;
5757
import static org.junit.jupiter.params.provider.Arguments.of;
58-
import static org.mockito.Matchers.anyBoolean;
59-
import static org.mockito.Matchers.anyLong;
58+
import static org.mockito.ArgumentMatchers.anyBoolean;
59+
import static org.mockito.ArgumentMatchers.anyLong;
6060
import static org.mockito.Mockito.*;
6161
import static reactor.rabbitmq.RabbitFlux.createReceiver;
6262
import static reactor.rabbitmq.RabbitFlux.createSender;
@@ -550,20 +550,28 @@ public void senderWithCustomChannelCloseHandler() throws Exception {
550550
}
551551

552552
@Test
553-
public void senderWithCustomChannelCloseHandlerPriority() {
553+
public void senderWithCustomChannelCloseHandlerPriority() throws InterruptedException {
554554
int nbMessages = 10;
555555
Flux<OutboundMessage> msgFlux = Flux.range(0, nbMessages).map(i -> new OutboundMessage("", queue, "".getBytes()));
556556

557557
SenderChannelCloseHandler channelCloseHandlerInSenderOptions = mock(SenderChannelCloseHandler.class);
558558
SenderChannelCloseHandler channelCloseHandlerInSendOptions = mock(SenderChannelCloseHandler.class);
559559

560+
CountDownLatch latch = new CountDownLatch(1);
561+
doAnswer(answer -> {
562+
latch.countDown();
563+
return null;
564+
}).when(channelCloseHandlerInSendOptions).accept(any(SignalType.class), any(Channel.class));
565+
560566
SenderOptions senderOptions = new SenderOptions().channelCloseHandler(channelCloseHandlerInSenderOptions);
561567
sender = createSender(senderOptions);
562568
SendOptions sendOptions = new SendOptions().channelCloseHandler(channelCloseHandlerInSendOptions);
563569

564570
StepVerifier.create(sender.send(msgFlux, sendOptions))
565571
.verifyComplete();
566572

573+
assertTrue(latch.await(1, TimeUnit.SECONDS));
574+
567575
verify(channelCloseHandlerInSenderOptions, never()).accept(any(SignalType.class), any(Channel.class));
568576
verify(channelCloseHandlerInSendOptions, times(1)).accept(any(SignalType.class), any(Channel.class));
569577
}
@@ -611,7 +619,8 @@ public void publishConfirmsErrorWhilePublishing() throws Exception {
611619

612620
doNothing()
613621
.doThrow(new IOException("simulated error while publishing"))
614-
.when(mockChannel).basicPublish(anyString(), anyString(), any(AMQP.BasicProperties.class), any(byte[].class));
622+
.when(mockChannel).basicPublish(anyString(), anyString(), nullable(AMQP.BasicProperties.class), any(byte[].class));
623+
615624

616625
int nbMessages = 10;
617626
Flux<OutboundMessage> msgFlux = Flux.range(0, nbMessages).map(i -> new OutboundMessage("", queue, "".getBytes()));

0 commit comments

Comments
 (0)