Skip to content

Commit 0fcb6c8

Browse files
committed
Adapt test to JUnit 4
[#159272967] References #52
1 parent 6846306 commit 0fcb6c8

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/test/java/com/rabbitmq/integration/tests/SelectorAppliedToTopicNotQueueIT.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
import com.rabbitmq.jms.admin.RMQConnectionFactory;
55
import com.rabbitmq.jms.client.message.RMQTextMessage;
6-
import org.junit.jupiter.api.AfterEach;
7-
import org.junit.jupiter.api.BeforeEach;
8-
import org.junit.jupiter.api.Test;
6+
import org.junit.After;
7+
import org.junit.Before;
8+
import org.junit.Test;
99

1010
import javax.jms.DeliveryMode;
1111
import javax.jms.JMSException;
@@ -20,13 +20,12 @@
2020
import javax.jms.TopicPublisher;
2121
import javax.jms.TopicSession;
2222

23-
import static org.junit.jupiter.api.Assertions.assertEquals;
24-
import static org.junit.jupiter.api.Assertions.assertThrows;
23+
import static org.junit.Assert.assertEquals;
2524

2625
/**
2726
* To make sure Session#createConsumer works for at least topic when a
2827
* selector is provided.
29-
*
28+
* <p>
3029
* See https://github.com/rabbitmq/rabbitmq-jms-client/issues/52
3130
*/
3231
public class SelectorAppliedToTopicNotQueueIT {
@@ -39,7 +38,7 @@ public class SelectorAppliedToTopicNotQueueIT {
3938
TopicConnection topicConn;
4039
QueueConnection queueConn;
4140

42-
@BeforeEach
41+
@Before
4342
public void beforeTests() throws Exception {
4443
this.connFactory =
4544
(RMQConnectionFactory) AbstractTestConnectionFactory.getTestConnectionFactory()
@@ -48,7 +47,7 @@ public void beforeTests() throws Exception {
4847
this.queueConn = connFactory.createQueueConnection();
4948
}
5049

51-
@AfterEach
50+
@After
5251
public void afterTests() throws Exception {
5352
if (this.topicConn != null)
5453
this.topicConn.close();
@@ -85,19 +84,19 @@ private void sendAndReceive(TopicSession topicSession, Topic topic, MessageConsu
8584
assertEquals(MESSAGE1, t);
8685
}
8786

88-
@Test
87+
@Test(expected = UnsupportedOperationException.class)
8988
public void sendAndReceiveNotSupportedOnQueue() throws Exception {
9089
queueConn.start();
9190
QueueSession queueSession = queueConn.createQueueSession(false, Session.DUPS_OK_ACKNOWLEDGE);
9291
Queue queue = queueSession.createQueue(QUEUE_NAME);
93-
assertThrows(UnsupportedOperationException.class, () -> queueSession.createConsumer(queue, "boolProp"));
92+
queueSession.createConsumer(queue, "boolProp");
9493
}
9594

96-
@Test
95+
@Test(expected = UnsupportedOperationException.class)
9796
public void sendAndReceiveNotSupportedOnQueueNoLocal() throws Exception {
9897
queueConn.start();
9998
QueueSession queueSession = queueConn.createQueueSession(false, Session.DUPS_OK_ACKNOWLEDGE);
10099
Queue queue = queueSession.createQueue(QUEUE_NAME);
101-
assertThrows(UnsupportedOperationException.class, () -> queueSession.createConsumer(queue, "boolProp", false));
100+
queueSession.createConsumer(queue, "boolProp", false);
102101
}
103102
}

0 commit comments

Comments
 (0)