Skip to content

Commit 7257ba5

Browse files
author
Matthew Sackman
committed
Correction of tests - error checking, and use of methods in superclass
1 parent 52b6a16 commit 7257ba5

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/src/com/rabbitmq/client/test/functional/PerQueueTTL.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,21 @@ public void testCreateQueueWithByteTTL() throws IOException {
6666
try {
6767
declareQueue(TTL_QUEUE_NAME, (byte)200);
6868
} catch(IOException ex) {
69-
fail("Should be able to use long for queue TTL");
69+
fail("Should be able to use byte for queue TTL");
7070
}
7171
}
7272
public void testCreateQueueWithShortTTL() throws IOException {
7373
try {
7474
declareQueue(TTL_QUEUE_NAME, (short)200);
7575
} catch(IOException ex) {
76-
fail("Should be able to use long for queue TTL");
76+
fail("Should be able to use short for queue TTL");
7777
}
7878
}
7979
public void testCreateQueueWithIntTTL() throws IOException {
8080
try {
8181
declareQueue(TTL_QUEUE_NAME, 200);
8282
} catch(IOException ex) {
83-
fail("Should be able to use long for queue TTL");
83+
fail("Should be able to use int for queue TTL");
8484
}
8585
}
8686

@@ -97,7 +97,7 @@ public void testCreateQueueWithInvalidTTL() throws Exception {
9797
declareQueue(TTL_INVALID_QUEUE_NAME, "foobar");
9898
fail("Should not be able to declare a queue with a non-long value for x-message-ttl");
9999
} catch (IOException e) {
100-
assertNotNull(e);
100+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, e);
101101
}
102102
}
103103

@@ -106,7 +106,7 @@ public void testTTLMustBeGtZero() throws Exception {
106106
declareQueue(TTL_INVALID_QUEUE_NAME, 0);
107107
fail("Should not be able to declare a queue with zero for x-message-ttl");
108108
} catch (IOException e) {
109-
assertNotNull(e);
109+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, e);
110110
}
111111
}
112112

@@ -115,7 +115,7 @@ public void testTTLMustBePositive() throws Exception {
115115
declareQueue(TTL_INVALID_QUEUE_NAME, -10);
116116
fail("Should not be able to declare a queue with zero for x-message-ttl");
117117
} catch (IOException e) {
118-
assertNotNull(e);
118+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, e);
119119
}
120120
}
121121

@@ -140,13 +140,13 @@ public void testPublishAndGetWithExpiry() throws Exception {
140140
byte[] msg2 = "two".getBytes();
141141
byte[] msg3 = "three".getBytes();
142142

143-
this.channel.basicPublish(TTL_EXCHANGE, TTL_QUEUE_NAME, null, msg1);
143+
basicPublishVolatile(msg1, TTL_EXCHANGE, TTL_QUEUE_NAME);
144144
Thread.sleep(1500);
145145

146-
this.channel.basicPublish(TTL_EXCHANGE, TTL_QUEUE_NAME, null, msg2);
146+
basicPublishVolatile(msg2, TTL_EXCHANGE, TTL_QUEUE_NAME);
147147
Thread.sleep(1000);
148148

149-
this.channel.basicPublish(TTL_EXCHANGE, TTL_QUEUE_NAME, null, msg3);
149+
basicPublishVolatile(msg3, TTL_EXCHANGE, TTL_QUEUE_NAME);
150150

151151
assertEquals("two", new String(get()));
152152
assertEquals("three", new String(get()));
@@ -166,10 +166,10 @@ public void testTransactionalPublishWithGet() throws Exception {
166166

167167
this.channel.txSelect();
168168

169-
this.channel.basicPublish(TTL_EXCHANGE, TTL_QUEUE_NAME, null, msg1);
169+
basicPublishVolatile(msg1, TTL_EXCHANGE, TTL_QUEUE_NAME);
170170
Thread.sleep(1500);
171171

172-
this.channel.basicPublish(TTL_EXCHANGE, TTL_QUEUE_NAME, null, msg2);
172+
basicPublishVolatile(msg2, TTL_EXCHANGE, TTL_QUEUE_NAME);
173173
this.channel.txCommit();
174174
Thread.sleep(500);
175175

@@ -181,7 +181,7 @@ public void testTransactionalPublishWithGet() throws Exception {
181181

182182

183183
private byte[] get() throws IOException {
184-
GetResponse response = this.channel.basicGet(TTL_QUEUE_NAME, false);
184+
GetResponse response = basicGet(TTL_QUEUE_NAME);
185185
if(response == null) {
186186
return null;
187187
}

0 commit comments

Comments
 (0)