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.
2828import static org .mockito .Mockito .mock ;
2929
3030import java .util .Collection ;
31- import java .util .Map ;
3231import java .util .Set ;
3332import java .util .concurrent .CyclicBarrier ;
3433import 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