Migrate rest of test suite from JUnit 4 to JUnit Jupiter

This commit migrates the rest of Spring's test suite to JUnit Jupiter,
except spring-test which will be migrated in a separate commit.

See gh-23451
This commit is contained in:
Sam Brannen
2019-08-13 12:57:37 +02:00
parent 3df85c783f
commit 3f3e41923f
1487 changed files with 5428 additions and 4782 deletions

View File

@@ -20,7 +20,7 @@ import java.lang.reflect.Method;
import javax.jms.JMSException;
import javax.jms.Session;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.jms.StubTextMessage;

View File

@@ -19,7 +19,7 @@ package org.springframework.jms.annotation;
import javax.jms.JMSException;
import javax.jms.MessageListener;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

View File

@@ -21,7 +21,7 @@ import java.lang.annotation.RetentionPolicy;
import javax.jms.JMSException;
import javax.jms.MessageListener;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.ConfigurableApplicationContext;

View File

@@ -22,7 +22,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.factory.BeanCreationException;

View File

@@ -25,8 +25,8 @@ import javax.jms.MessageListener;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
@@ -58,7 +58,7 @@ public class JmsListenerContainerFactoryIntegrationTests {
private JmsEndpointSampleInterface listener = sample;
@Before
@BeforeEach
public void setup() {
initializeFactory(factory);
}

View File

@@ -21,7 +21,7 @@ import javax.jms.MessageListener;
import javax.jms.Session;
import javax.transaction.TransactionManager;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.jms.StubConnectionFactory;

View File

@@ -16,8 +16,8 @@
package org.springframework.jms.config;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
@@ -37,7 +37,7 @@ public class JmsListenerEndpointRegistrarTests {
private final JmsListenerContainerTestFactory containerFactory = new JmsListenerContainerTestFactory();
@Before
@BeforeEach
public void setup() {
this.registrar.setEndpointRegistry(this.registry);
this.registrar.setBeanFactory(new StaticListableBeanFactory());

View File

@@ -16,7 +16,7 @@
package org.springframework.jms.config;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;

View File

@@ -18,7 +18,7 @@ package org.springframework.jms.config;
import javax.jms.MessageListener;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.jms.listener.DefaultMessageListenerContainer;

View File

@@ -25,9 +25,9 @@ import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.config.BeanDefinition;
@@ -67,12 +67,12 @@ public class JmsNamespaceHandlerTests {
private ToolingTestApplicationContext context;
@Before
@BeforeEach
public void setUp() throws Exception {
this.context = new ToolingTestApplicationContext("jmsNamespaceHandlerTests.xml", getClass());
}
@After
@AfterEach
public void tearDown() throws Exception {
this.context.close();
}

View File

@@ -29,10 +29,9 @@ import javax.jms.QueueSender;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
@@ -71,8 +70,9 @@ import static org.mockito.Mockito.verify;
/**
* @author Stephane Nicoll
* @author Sam Brannen
*/
public class MethodJmsListenerEndpointTests {
class MethodJmsListenerEndpointTests {
private final DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory();
@@ -80,19 +80,18 @@ public class MethodJmsListenerEndpointTests {
private final JmsEndpointSampleBean sample = new JmsEndpointSampleBean();
@Rule
public final TestName name = new TestName();
private String methodName;
@Before
public void setup() {
@BeforeEach
void setup(TestInfo testInfo) {
this.methodName = testInfo.getTestMethod().get().getName();
initializeFactory(this.factory);
}
@Test
public void createMessageListenerNoFactory() {
void createMessageListenerNoFactory() {
MethodJmsListenerEndpoint endpoint = new MethodJmsListenerEndpoint();
endpoint.setBean(this);
endpoint.setMethod(getTestMethod());
@@ -102,7 +101,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void createMessageListener() {
void createMessageListener() {
MethodJmsListenerEndpoint endpoint = new MethodJmsListenerEndpoint();
endpoint.setBean(this);
endpoint.setMethod(getTestMethod());
@@ -112,7 +111,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void setExtraCollaborators() {
void setExtraCollaborators() {
MessageConverter messageConverter = mock(MessageConverter.class);
DestinationResolver destinationResolver = mock(DestinationResolver.class);
this.container.setMessageConverter(messageConverter);
@@ -126,7 +125,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveMessageAndSession() throws JMSException {
void resolveMessageAndSession() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(javax.jms.Message.class, Session.class);
Session session = mock(Session.class);
@@ -135,7 +134,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveGenericMessage() throws JMSException {
void resolveGenericMessage() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(Message.class);
Session session = mock(Session.class);
@@ -144,7 +143,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveHeaderAndPayload() throws JMSException {
void resolveHeaderAndPayload() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(String.class, int.class);
Session session = mock(Session.class);
@@ -155,7 +154,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveCustomHeaderNameAndPayload() throws JMSException {
void resolveCustomHeaderNameAndPayload() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(String.class, int.class);
Session session = mock(Session.class);
@@ -166,7 +165,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveCustomHeaderNameAndPayloadWithHeaderNameSet() throws JMSException {
void resolveCustomHeaderNameAndPayloadWithHeaderNameSet() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(String.class, int.class);
Session session = mock(Session.class);
@@ -177,7 +176,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveHeaders() throws JMSException {
void resolveHeaders() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(String.class, Map.class);
Session session = mock(Session.class);
@@ -189,7 +188,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveMessageHeaders() throws JMSException {
void resolveMessageHeaders() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(MessageHeaders.class);
Session session = mock(Session.class);
@@ -201,7 +200,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveJmsMessageHeaderAccessor() throws JMSException {
void resolveJmsMessageHeaderAccessor() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(JmsMessageHeaderAccessor.class);
Session session = mock(Session.class);
@@ -213,7 +212,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveObjectPayload() throws JMSException {
void resolveObjectPayload() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(MyBean.class);
MyBean myBean = new MyBean();
myBean.name = "myBean name";
@@ -227,7 +226,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void resolveConvertedPayload() throws JMSException {
void resolveConvertedPayload() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(Integer.class);
Session session = mock(Session.class);
@@ -237,7 +236,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void processAndReply() throws JMSException {
void processAndReply() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);
String body = "echo text";
String correlationId = "link-1234";
@@ -261,7 +260,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void processAndReplyWithSendToQueue() throws JMSException {
void processAndReplyWithSendToQueue() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
MessagingMessageListenerAdapter listener = createInstance(this.factory,
@@ -271,7 +270,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void processFromTopicAndReplyWithSendToQueue() throws JMSException {
void processFromTopicAndReplyWithSendToQueue() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setPubSubDomain(true);
@@ -283,7 +282,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void processAndReplyWithSendToTopic() throws JMSException {
void processAndReplyWithSendToTopic() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setPubSubDomain(true);
@@ -294,7 +293,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void processFromQueueAndReplyWithSendToTopic() throws JMSException {
void processFromQueueAndReplyWithSendToTopic() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setReplyPubSubDomain(true);
@@ -305,14 +304,14 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void processAndReplyWithDefaultSendTo() throws JMSException {
void processAndReplyWithDefaultSendTo() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);
processAndReplyWithSendTo(listener, "defaultReply", false);
assertDefaultListenerMethodInvocation();
}
@Test
public void processAndReplyWithCustomReplyQosSettings() throws JMSException {
void processAndReplyWithCustomReplyQosSettings() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
QosSettings replyQosSettings = new QosSettings(1, 6, 6000);
@@ -324,7 +323,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void processAndReplyWithNullReplyQosSettings() throws JMSException {
void processAndReplyWithNullReplyQosSettings() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setReplyQosSettings(null);
@@ -374,7 +373,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void emptySendTo() throws JMSException {
void emptySendTo() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);
TextMessage reply = mock(TextMessage.class);
@@ -387,7 +386,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void invalidSendTo() {
void invalidSendTo() {
assertThatIllegalStateException().isThrownBy(() ->
createDefaultInstance(String.class))
.withMessageContaining("firstDestination")
@@ -395,7 +394,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void validatePayloadValid() throws JMSException {
void validatePayloadValid() throws JMSException {
String methodName = "validatePayload";
DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory();
@@ -410,7 +409,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void validatePayloadInvalid() throws JMSException {
void validatePayloadInvalid() throws JMSException {
DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory();
customFactory.setValidator(testValidator("invalid value"));
@@ -427,7 +426,7 @@ public class MethodJmsListenerEndpointTests {
// failure scenario
@Test
public void invalidPayloadType() throws JMSException {
void invalidPayloadType() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(Integer.class);
Session session = mock(Session.class);
@@ -439,7 +438,7 @@ public class MethodJmsListenerEndpointTests {
}
@Test
public void invalidMessagePayloadType() throws JMSException {
void invalidMessagePayloadType() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(Message.class);
Session session = mock(Session.class);
@@ -479,11 +478,11 @@ public class MethodJmsListenerEndpointTests {
}
private Method getDefaultListenerMethod(Class<?>... parameterTypes) {
return getListenerMethod(this.name.getMethodName(), parameterTypes);
return getListenerMethod(this.methodName, parameterTypes);
}
private void assertDefaultListenerMethodInvocation() {
assertListenerMethodInvocation(this.sample, this.name.getMethodName());
assertListenerMethodInvocation(this.sample, this.methodName);
}
private void assertListenerMethodInvocation(JmsEndpointSampleBean bean, String methodName) {
@@ -512,7 +511,7 @@ public class MethodJmsListenerEndpointTests {
}
private Method getTestMethod() {
return ReflectionUtils.findMethod(MethodJmsListenerEndpointTests.class, this.name.getMethodName());
return ReflectionUtils.findMethod(MethodJmsListenerEndpointTests.class, this.methodName);
}

View File

@@ -18,7 +18,7 @@ package org.springframework.jms.config;
import javax.jms.MessageListener;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jms.listener.SimpleMessageListenerContainer;
import org.springframework.jms.listener.adapter.MessageListenerAdapter;

View File

@@ -24,8 +24,8 @@ import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.jms.StubQueue;
import org.springframework.jms.core.JmsTemplate;
@@ -51,7 +51,7 @@ import static org.mockito.Mockito.verify;
*/
public class JmsTransactionManagerTests {
@After
@AfterEach
public void verifyTransactionSynchronizationManagerState() {
assertThat(TransactionSynchronizationManager.getResourceMap().isEmpty()).isTrue();
assertThat(TransactionSynchronizationManager.isSynchronizationActive()).isFalse();

View File

@@ -28,7 +28,7 @@ import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicSession;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;

View File

@@ -26,13 +26,13 @@ import javax.jms.MessageNotWriteableException;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.stubbing.Answer;
import org.springframework.beans.DirectFieldAccessor;
@@ -65,7 +65,7 @@ import static org.mockito.Mockito.verify;
*
* @author Stephane Nicoll
*/
@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class JmsMessagingTemplateTests {
@Captor
@@ -77,7 +77,7 @@ public class JmsMessagingTemplateTests {
private JmsMessagingTemplate messagingTemplate;
@Before
@BeforeEach
public void setup() {
this.messagingTemplate = new JmsMessagingTemplate(this.jmsTemplate);
}

View File

@@ -33,8 +33,8 @@ import javax.jms.TemporaryQueue;
import javax.jms.TextMessage;
import javax.naming.Context;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.jms.InvalidClientIDException;
import org.springframework.jms.InvalidDestinationException;
@@ -75,7 +75,7 @@ import static org.mockito.Mockito.verify;
* @author Mark Pollack
* @author Stephane Nicoll
*/
public class JmsTemplateTests {
class JmsTemplateTests {
private Context jndiContext;
@@ -93,8 +93,8 @@ public class JmsTemplateTests {
/**
* Create the mock objects for testing.
*/
@Before
public void setupMocks() throws Exception {
@BeforeEach
void setupMocks() throws Exception {
this.jndiContext = mock(Context.class);
this.connectionFactory = mock(ConnectionFactory.class);
this.connection = mock(Connection.class);
@@ -135,7 +135,7 @@ public class JmsTemplateTests {
@Test
public void testExceptionStackTrace() {
void testExceptionStackTrace() {
JMSException jmsEx = new JMSException("could not connect");
Exception innerEx = new Exception("host not found");
jmsEx.setLinkedException(innerEx);
@@ -148,7 +148,7 @@ public class JmsTemplateTests {
}
@Test
public void testProducerCallback() throws Exception {
void testProducerCallback() throws Exception {
JmsTemplate template = createTemplate();
template.setConnectionFactory(this.connectionFactory);
@@ -168,7 +168,7 @@ public class JmsTemplateTests {
}
@Test
public void testProducerCallbackWithIdAndTimestampDisabled() throws Exception {
void testProducerCallbackWithIdAndTimestampDisabled() throws Exception {
JmsTemplate template = createTemplate();
template.setConnectionFactory(this.connectionFactory);
template.setMessageIdEnabled(false);
@@ -195,7 +195,7 @@ public class JmsTemplateTests {
* Test the method execute(SessionCallback action).
*/
@Test
public void testSessionCallback() throws Exception {
void testSessionCallback() throws Exception {
JmsTemplate template = createTemplate();
template.setConnectionFactory(this.connectionFactory);
@@ -212,7 +212,7 @@ public class JmsTemplateTests {
}
@Test
public void testSessionCallbackWithinSynchronizedTransaction() throws Exception {
void testSessionCallbackWithinSynchronizedTransaction() throws Exception {
SingleConnectionFactory scf = new SingleConnectionFactory(this.connectionFactory);
JmsTemplate template = createTemplate();
template.setConnectionFactory(scf);
@@ -272,7 +272,7 @@ public class JmsTemplateTests {
* send(Destination d, MessageCreator messageCreator)
*/
@Test
public void testSendDestination() throws Exception {
void testSendDestination() throws Exception {
doTestSendDestination(true, false, true, false);
}
@@ -281,7 +281,7 @@ public class JmsTemplateTests {
* send(String d, MessageCreator messageCreator)
*/
@Test
public void testSendDestinationName() throws Exception {
void testSendDestinationName() throws Exception {
doTestSendDestination(false, false, true, false);
}
@@ -290,7 +290,7 @@ public class JmsTemplateTests {
* send(Destination d, MessageCreator messageCreator) using QOS parameters.
*/
@Test
public void testSendDestinationWithQOS() throws Exception {
void testSendDestinationWithQOS() throws Exception {
doTestSendDestination(true, false, false, true);
}
@@ -299,7 +299,7 @@ public class JmsTemplateTests {
* send(String d, MessageCreator messageCreator) using QOS parameters.
*/
@Test
public void testSendDestinationNameWithQOS() throws Exception {
void testSendDestinationNameWithQOS() throws Exception {
doTestSendDestination(false, false, false, true);
}
@@ -307,7 +307,7 @@ public class JmsTemplateTests {
* Test sending to the default destination.
*/
@Test
public void testSendDefaultDestination() throws Exception {
void testSendDefaultDestination() throws Exception {
doTestSendDestination(true, true, true, true);
}
@@ -315,7 +315,7 @@ public class JmsTemplateTests {
* Test sending to the default destination name.
*/
@Test
public void testSendDefaultDestinationName() throws Exception {
void testSendDefaultDestinationName() throws Exception {
doTestSendDestination(false, true, true, true);
}
@@ -323,7 +323,7 @@ public class JmsTemplateTests {
* Test sending to the default destination using explicit QOS parameters.
*/
@Test
public void testSendDefaultDestinationWithQOS() throws Exception {
void testSendDefaultDestinationWithQOS() throws Exception {
doTestSendDestination(true, true, false, false);
}
@@ -331,7 +331,7 @@ public class JmsTemplateTests {
* Test sending to the default destination name using explicit QOS parameters.
*/
@Test
public void testSendDefaultDestinationNameWithQOS() throws Exception {
void testSendDefaultDestinationNameWithQOS() throws Exception {
doTestSendDestination(false, true, false, false);
}
@@ -421,7 +421,7 @@ public class JmsTemplateTests {
}
@Test
public void testConverter() throws Exception {
void testConverter() throws Exception {
JmsTemplate template = createTemplate();
template.setConnectionFactory(this.connectionFactory);
template.setMessageConverter(new SimpleMessageConverter());
@@ -445,87 +445,87 @@ public class JmsTemplateTests {
}
@Test
public void testReceiveDefaultDestination() throws Exception {
void testReceiveDefaultDestination() throws Exception {
doTestReceive(true, true, false, false, false, false, JmsTemplate.RECEIVE_TIMEOUT_INDEFINITE_WAIT);
}
@Test
public void testReceiveDefaultDestinationName() throws Exception {
void testReceiveDefaultDestinationName() throws Exception {
doTestReceive(false, true, false, false, false, false, JmsTemplate.RECEIVE_TIMEOUT_INDEFINITE_WAIT);
}
@Test
public void testReceiveDestination() throws Exception {
void testReceiveDestination() throws Exception {
doTestReceive(true, false, false, false, false, true, JmsTemplate.RECEIVE_TIMEOUT_INDEFINITE_WAIT);
}
@Test
public void testReceiveDestinationWithClientAcknowledge() throws Exception {
void testReceiveDestinationWithClientAcknowledge() throws Exception {
doTestReceive(true, false, false, true, false, false, 1000);
}
@Test
public void testReceiveDestinationName() throws Exception {
void testReceiveDestinationName() throws Exception {
doTestReceive(false, false, false, false, false, true, 1000);
}
@Test
public void testReceiveDefaultDestinationWithSelector() throws Exception {
void testReceiveDefaultDestinationWithSelector() throws Exception {
doTestReceive(true, true, false, false, true, true, 1000);
}
@Test
public void testReceiveDefaultDestinationNameWithSelector() throws Exception {
void testReceiveDefaultDestinationNameWithSelector() throws Exception {
doTestReceive(false, true, false, false, true, true, JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT);
}
@Test
public void testReceiveDestinationWithSelector() throws Exception {
void testReceiveDestinationWithSelector() throws Exception {
doTestReceive(true, false, false, false, true, false, 1000);
}
@Test
public void testReceiveDestinationWithClientAcknowledgeWithSelector() throws Exception {
void testReceiveDestinationWithClientAcknowledgeWithSelector() throws Exception {
doTestReceive(true, false, false, true, true, true, JmsTemplate.RECEIVE_TIMEOUT_INDEFINITE_WAIT);
}
@Test
public void testReceiveDestinationNameWithSelector() throws Exception {
void testReceiveDestinationNameWithSelector() throws Exception {
doTestReceive(false, false, false, false, true, false, JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT);
}
@Test
public void testReceiveAndConvertDefaultDestination() throws Exception {
void testReceiveAndConvertDefaultDestination() throws Exception {
doTestReceive(true, true, true, false, false, false, 1000);
}
@Test
public void testReceiveAndConvertDefaultDestinationName() throws Exception {
void testReceiveAndConvertDefaultDestinationName() throws Exception {
doTestReceive(false, true, true, false, false, false, 1000);
}
@Test
public void testReceiveAndConvertDestinationName() throws Exception {
void testReceiveAndConvertDestinationName() throws Exception {
doTestReceive(false, false, true, false, false, true, JmsTemplate.RECEIVE_TIMEOUT_INDEFINITE_WAIT);
}
@Test
public void testReceiveAndConvertDestination() throws Exception {
void testReceiveAndConvertDestination() throws Exception {
doTestReceive(true, false, true, false, false, true, 1000);
}
@Test
public void testReceiveAndConvertDefaultDestinationWithSelector() throws Exception {
void testReceiveAndConvertDefaultDestinationWithSelector() throws Exception {
doTestReceive(true, true, true, false, true, true, JmsTemplate.RECEIVE_TIMEOUT_NO_WAIT);
}
@Test
public void testReceiveAndConvertDestinationNameWithSelector() throws Exception {
void testReceiveAndConvertDestinationNameWithSelector() throws Exception {
doTestReceive(false, false, true, false, true, true, JmsTemplate.RECEIVE_TIMEOUT_INDEFINITE_WAIT);
}
@Test
public void testReceiveAndConvertDestinationWithSelector() throws Exception {
void testReceiveAndConvertDestinationWithSelector() throws Exception {
doTestReceive(true, false, true, false, true, false, 1000);
}
@@ -636,22 +636,22 @@ public class JmsTemplateTests {
}
@Test
public void testSendAndReceiveDefaultDestination() throws Exception {
void testSendAndReceiveDefaultDestination() throws Exception {
doTestSendAndReceive(true, true, 1000L);
}
@Test
public void testSendAndReceiveDefaultDestinationName() throws Exception {
void testSendAndReceiveDefaultDestinationName() throws Exception {
doTestSendAndReceive(false, true, 1000L);
}
@Test
public void testSendAndReceiveDestination() throws Exception {
void testSendAndReceiveDestination() throws Exception {
doTestSendAndReceive(true, false, 1000L);
}
@Test
public void testSendAndReceiveDestinationName() throws Exception {
void testSendAndReceiveDestinationName() throws Exception {
doTestSendAndReceive(false, false, 1000L);
}
@@ -719,67 +719,67 @@ public class JmsTemplateTests {
}
@Test
public void testIllegalStateException() throws Exception {
void testIllegalStateException() throws Exception {
doTestJmsException(new javax.jms.IllegalStateException(""), org.springframework.jms.IllegalStateException.class);
}
@Test
public void testInvalidClientIDException() throws Exception {
void testInvalidClientIDException() throws Exception {
doTestJmsException(new javax.jms.InvalidClientIDException(""), InvalidClientIDException.class);
}
@Test
public void testInvalidDestinationException() throws Exception {
void testInvalidDestinationException() throws Exception {
doTestJmsException(new javax.jms.InvalidDestinationException(""), InvalidDestinationException.class);
}
@Test
public void testInvalidSelectorException() throws Exception {
void testInvalidSelectorException() throws Exception {
doTestJmsException(new javax.jms.InvalidSelectorException(""), InvalidSelectorException.class);
}
@Test
public void testJmsSecurityException() throws Exception {
void testJmsSecurityException() throws Exception {
doTestJmsException(new javax.jms.JMSSecurityException(""), JmsSecurityException.class);
}
@Test
public void testMessageEOFException() throws Exception {
void testMessageEOFException() throws Exception {
doTestJmsException(new javax.jms.MessageEOFException(""), MessageEOFException.class);
}
@Test
public void testMessageFormatException() throws Exception {
void testMessageFormatException() throws Exception {
doTestJmsException(new javax.jms.MessageFormatException(""), MessageFormatException.class);
}
@Test
public void testMessageNotReadableException() throws Exception {
void testMessageNotReadableException() throws Exception {
doTestJmsException(new javax.jms.MessageNotReadableException(""), MessageNotReadableException.class);
}
@Test
public void testMessageNotWriteableException() throws Exception {
void testMessageNotWriteableException() throws Exception {
doTestJmsException(new javax.jms.MessageNotWriteableException(""), MessageNotWriteableException.class);
}
@Test
public void testResourceAllocationException() throws Exception {
void testResourceAllocationException() throws Exception {
doTestJmsException(new javax.jms.ResourceAllocationException(""), ResourceAllocationException.class);
}
@Test
public void testTransactionInProgressException() throws Exception {
void testTransactionInProgressException() throws Exception {
doTestJmsException(new javax.jms.TransactionInProgressException(""), TransactionInProgressException.class);
}
@Test
public void testTransactionRolledBackException() throws Exception {
void testTransactionRolledBackException() throws Exception {
doTestJmsException(new javax.jms.TransactionRolledBackException(""), TransactionRolledBackException.class);
}
@Test
public void testUncategorizedJmsException() throws Exception {
void testUncategorizedJmsException() throws Exception {
doTestJmsException(new javax.jms.JMSException(""), UncategorizedJmsException.class);
}

View File

@@ -18,6 +18,8 @@ package org.springframework.jms.core;
import javax.jms.Session;
import org.junit.jupiter.api.BeforeEach;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
@@ -26,13 +28,14 @@ import static org.mockito.Mockito.mock;
* @author Stephane Nicoll
* @since 06.01.2005
*/
public class JmsTemplateTransactedTests extends JmsTemplateTests {
class JmsTemplateTransactedTests extends JmsTemplateTests {
private Session localSession;
@Override
public void setupMocks() throws Exception {
@BeforeEach
void setupMocks() throws Exception {
super.setupMocks();
this.localSession = mock(Session.class);
given(this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE)).willReturn(this.localSession);

View File

@@ -19,7 +19,7 @@ import java.util.ArrayList;
import java.util.List;
import javax.jms.ConnectionFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jms.core.JmsTemplate;

View File

@@ -23,7 +23,7 @@ import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

View File

@@ -27,7 +27,7 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Session;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.task.TaskExecutor;

View File

@@ -20,7 +20,7 @@ import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Session;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jms.support.destination.DestinationResolver;

View File

@@ -30,7 +30,7 @@ import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

View File

@@ -29,8 +29,8 @@ import javax.jms.TextMessage;
import javax.jms.Topic;
import com.fasterxml.jackson.annotation.JsonView;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.support.StaticListableBeanFactory;
import org.springframework.jms.StubTextMessage;
@@ -67,7 +67,7 @@ public class MessagingMessageListenerAdapterTests {
private final SampleBean sample = new SampleBean();
@Before
@BeforeEach
public void setup() {
initializeFactory(factory);
}

View File

@@ -19,7 +19,7 @@ package org.springframework.jms.listener.endpoint;
import javax.jms.Destination;
import javax.jms.Session;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jca.StubResourceAdapter;
import org.springframework.jms.StubQueue;

View File

@@ -16,7 +16,7 @@
package org.springframework.jms.listener.endpoint;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jms.support.QosSettings;

View File

@@ -31,8 +31,8 @@ import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSession;
import javax.jms.Session;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.jms.support.converter.MessageConversionException;
import org.springframework.jms.support.converter.SimpleMessageConverter;
@@ -61,7 +61,7 @@ public class JmsInvokerTests {
private Queue mockQueue;
@Before
@BeforeEach
public void setUpMocks() throws Exception {
mockConnectionFactory = mock(QueueConnectionFactory.class);
mockConnection = mock(QueueConnection.class);

View File

@@ -18,7 +18,7 @@ package org.springframework.jms.support;
import javax.jms.Session;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

View File

@@ -20,7 +20,7 @@ import java.util.Map;
import javax.jms.Destination;
import javax.jms.JMSException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jms.StubTextMessage;
import org.springframework.messaging.Message;

View File

@@ -22,7 +22,7 @@ import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jms.StubTextMessage;
import org.springframework.messaging.Message;

View File

@@ -28,7 +28,7 @@ import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

View File

@@ -28,8 +28,8 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import com.fasterxml.jackson.annotation.JsonView;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -55,7 +55,7 @@ public class MappingJackson2MessageConverterTests {
private Session sessionMock;
@Before
@BeforeEach
public void setup() {
sessionMock = mock(Session.class);
converter = new MappingJackson2MessageConverter();

View File

@@ -22,8 +22,8 @@ import javax.jms.TextMessage;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
@@ -49,7 +49,7 @@ public class MarshallingMessageConverterTests {
private Session sessionMock;
@Before
@BeforeEach
public void setup() throws Exception {
marshallerMock = mock(Marshaller.class);
unmarshallerMock = mock(Unmarshaller.class);

View File

@@ -22,7 +22,7 @@ import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jms.StubTextMessage;
import org.springframework.messaging.Message;

View File

@@ -24,7 +24,7 @@ import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TopicSession;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jms.StubQueue;
import org.springframework.jms.StubTopic;

View File

@@ -18,7 +18,7 @@ package org.springframework.jms.support.destination;
import javax.jms.ConnectionFactory;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

View File

@@ -20,7 +20,7 @@ import javax.jms.Destination;
import javax.jms.Session;
import javax.naming.NamingException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.springframework.jms.StubTopic;