Skip to content

Commit 09c3c93

Browse files
Add test case
1 parent d97be88 commit 09c3c93

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.rabbitmq.client.test.functional;
2+
3+
import com.rabbitmq.client.AlreadyClosedException;
4+
import com.rabbitmq.client.test.BrokerTestCase;
5+
6+
import java.io.IOException;
7+
import java.util.UUID;
8+
9+
public class ExceptionMessages extends BrokerTestCase {
10+
public void testAlreadyClosedExceptionMessageWithChannelError() throws IOException {
11+
String uuid = UUID.randomUUID().toString();
12+
try {
13+
channel.queueDeclarePassive(uuid);
14+
fail("expected queueDeclarePassive to throw");
15+
} catch (IOException e) {
16+
// ignored
17+
}
18+
19+
try {
20+
channel.queueDeclarePassive(uuid);
21+
fail("expected queueDeclarePassive to throw");
22+
} catch (AlreadyClosedException ace) {
23+
assertTrue(ace.getMessage().startsWith("channel is already closed due to channel error"));
24+
}
25+
}
26+
27+
public void testAlreadyClosedExceptionMessageWithCleanClose() throws IOException {
28+
String uuid = UUID.randomUUID().toString();
29+
30+
try {
31+
channel.close();
32+
channel.queueDeclare(uuid, false, false, false, null);
33+
} catch (AlreadyClosedException ace) {
34+
assertTrue(ace.getMessage().startsWith("channel is already closed due to clean channel shutdown"));
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)