Skip to content

Commit 21fff59

Browse files
committed
Fix compatibility with the latest Spring AMQP
Related to the https://jira.spring.io/browse/AMQP-820
1 parent 69af967 commit 21fff59

File tree

1 file changed

+11
-15
lines changed
  • spring-integration-amqp/src/test/java/org/springframework/integration/amqp/channel

1 file changed

+11
-15
lines changed

spring-integration-amqp/src/test/java/org/springframework/integration/amqp/channel/ChannelTests.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2017 the original author or authors.
2+
* Copyright 2014-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@
2828
import static org.mockito.Mockito.mock;
2929

3030
import java.util.Collection;
31-
import java.util.Map;
3231
import java.util.Set;
3332
import java.util.concurrent.CyclicBarrier;
3433
import java.util.concurrent.TimeUnit;
@@ -124,20 +123,21 @@ public void pubSubLostConnectionTest() throws Exception {
124123
catch (Exception e) {
125124
}
126125
});
127-
this.channel.send(new GenericMessage<String>("foo"));
126+
this.channel.send(new GenericMessage<>("foo"));
128127
latch.await(10, TimeUnit.SECONDS);
129128
latch.reset();
130129
BlockingQueueConsumer consumer = (BlockingQueueConsumer) TestUtils.getPropertyValue(this.channel,
131130
"container.consumers", Set.class).iterator().next();
132131
connectionFactory.destroy();
133132
waitForNewConsumer(this.channel, consumer);
134-
this.channel.send(new GenericMessage<String>("bar"));
133+
this.channel.send(new GenericMessage<>("bar"));
135134
latch.await(10, TimeUnit.SECONDS);
136135
this.channel.destroy();
137136
this.pubSubWithEP.destroy();
138137
this.withEP.destroy();
139138
this.pollableWithEP.destroy();
140-
assertEquals(0, TestUtils.getPropertyValue(connectionFactory, "connectionListener.delegates", Collection.class).size());
139+
assertEquals(0,
140+
TestUtils.getPropertyValue(connectionFactory, "connectionListener.delegates", Collection.class).size());
141141
}
142142

143143
@SuppressWarnings("unchecked")
@@ -151,8 +151,7 @@ private void waitForNewConsumer(PublishSubscribeAmqpChannel channel, BlockingQue
151151
synchronized (consumersMonitor) {
152152
if (!consumers.isEmpty()) {
153153
BlockingQueueConsumer newConsumer = consumers.iterator().next();
154-
if (newConsumer != consumer && TestUtils.getPropertyValue(newConsumer,
155-
"consumerTags", Map.class).size() > 0) {
154+
if (newConsumer != consumer && newConsumer.getConsumerTags().size() > 0) {
156155
break;
157156
}
158157
}
@@ -221,7 +220,7 @@ public void testAmqpChannelFactoryBean() throws Exception {
221220
}
222221

223222
@Test
224-
public void extractPayloadTests() throws Exception {
223+
public void extractPayloadTests() {
225224
Foo foo = new Foo("bar");
226225
Message<?> message = MessageBuilder.withPayload(foo).setHeader("baz", "qux").build();
227226
this.pollableWithEP.send(message);
@@ -247,7 +246,7 @@ public void extractPayloadTests() throws Exception {
247246
}
248247

249248
@Test
250-
public void messageConversionTests() throws Exception {
249+
public void messageConversionTests() {
251250
RabbitTemplate amqpTemplate = new RabbitTemplate(this.connectionFactory);
252251
MessageConverter messageConverter = mock(MessageConverter.class);
253252
amqpTemplate.setMessageConverter(messageConverter);
@@ -303,14 +302,11 @@ public boolean equals(Object obj) {
303302
}
304303
Foo other = (Foo) obj;
305304
if (this.bar == null) {
306-
if (other.bar != null) {
307-
return false;
308-
}
305+
return other.bar == null;
309306
}
310-
else if (!this.bar.equals(other.bar)) {
311-
return false;
307+
else {
308+
return this.bar.equals(other.bar);
312309
}
313-
return true;
314310
}
315311

316312
}

0 commit comments

Comments
 (0)