Browse Source

Suppress deprecation warnings in JmsInvokerTests

pull/25585/head
Sam Brannen 4 years ago
parent
commit
6a2939a4d4
  1. 29
      spring-jms/src/test/java/org/springframework/jms/remoting/JmsInvokerTests.java

29
spring-jms/src/test/java/org/springframework/jms/remoting/JmsInvokerTests.java

@ -51,42 +51,38 @@ import static org.mockito.Mockito.mock; @@ -51,42 +51,38 @@ import static org.mockito.Mockito.mock;
* @author Juergen Hoeller
* @author Stephane Nicoll
*/
public class JmsInvokerTests {
class JmsInvokerTests {
private QueueConnectionFactory mockConnectionFactory;
private QueueConnectionFactory mockConnectionFactory = mock(QueueConnectionFactory.class);
private QueueConnection mockConnection;
private QueueConnection mockConnection = mock(QueueConnection.class);
private QueueSession mockSession;
private QueueSession mockSession = mock(QueueSession.class);
private Queue mockQueue;
private Queue mockQueue = mock(Queue.class);
@BeforeEach
public void setUpMocks() throws Exception {
mockConnectionFactory = mock(QueueConnectionFactory.class);
mockConnection = mock(QueueConnection.class);
mockSession = mock(QueueSession.class);
mockQueue = mock(Queue.class);
void setUpMocks() throws Exception {
given(mockConnectionFactory.createConnection()).willReturn(mockConnection);
given(mockConnection.createSession(false, Session.AUTO_ACKNOWLEDGE)).willReturn(mockSession);
}
@Test
public void testJmsInvokerProxyFactoryBeanAndServiceExporter() throws Throwable {
void jmsInvokerProxyFactoryBeanAndServiceExporter() throws Throwable {
doTestJmsInvokerProxyFactoryBeanAndServiceExporter(false);
}
@Test
public void testJmsInvokerProxyFactoryBeanAndServiceExporterWithDynamicQueue() throws Throwable {
void jmsInvokerProxyFactoryBeanAndServiceExporterWithDynamicQueue() throws Throwable {
given(mockSession.createQueue("myQueue")).willReturn(mockQueue);
doTestJmsInvokerProxyFactoryBeanAndServiceExporter(true);
}
@Test
public void receiveTimeoutExpired() {
@SuppressWarnings("deprecation")
void receiveTimeoutExpired() {
JmsInvokerProxyFactoryBean pfb = new JmsInvokerProxyFactoryBean() {
@Override
protected Message doExecuteRequest(Session session, Queue queue, Message requestMessage) throws JMSException {
@ -106,6 +102,7 @@ public class JmsInvokerTests { @@ -106,6 +102,7 @@ public class JmsInvokerTests {
.withMessageContaining("getAge");
}
@SuppressWarnings("deprecation")
private void doTestJmsInvokerProxyFactoryBeanAndServiceExporter(boolean dynamicQueue) throws Throwable {
TestBean target = new TestBean("myname", 99);
@ -154,9 +151,9 @@ public class JmsInvokerTests { @@ -154,9 +151,9 @@ public class JmsInvokerTests {
private static class ResponseStoringProducer implements MessageProducer {
public Message response;
Message response;
public boolean closed = false;
boolean closed = false;
@Override
public void setDisableMessageID(boolean b) throws JMSException {

Loading…
Cancel
Save