Skip to content

Commit 94245e4

Browse files
author
Alexandru Scvortov
committed
refactor and thighten a test
1 parent 3bbcf5d commit 94245e4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public void testDeadLetterEmpty() throws Exception {
8787
declareQueue(TEST_QUEUE_NAME, DLX, null, null);
8888
channel.queuePurge(TEST_QUEUE_NAME);
8989
channel.queueDelete(TEST_QUEUE_NAME);
90+
// Nothing was dead-lettered.
91+
consumeN(DLQ, 0, WithResponse.NULL);
9092
}
9193

9294
public void testDeadLetterQueueTTLExpiredMessages() throws Exception {
@@ -191,10 +193,7 @@ public void testDeadLetterSelf() throws Exception {
191193
sleep(200);
192194

193195
// The messages will NOT be dead-lettered to self.
194-
consumeN(TEST_QUEUE_NAME, 0, new WithResponse() {
195-
public void process(GetResponse getResponse) {
196-
}
197-
});
196+
consumeN(TEST_QUEUE_NAME, 0, WithResponse.NULL);
198197
}
199198

200199
public void testDeadLetterNewRK() throws Exception {
@@ -216,10 +215,7 @@ public void testDeadLetterNewRK() throws Exception {
216215

217216
sleep(100);
218217

219-
consumeN(DLQ, 0, new WithResponse() {
220-
public void process(GetResponse getResponse) {
221-
}
222-
});
218+
consumeN(DLQ, 0, WithResponse.NULL);
223219
consumeN(DLQ2, MSG_COUNT, new WithResponse() {
224220
@SuppressWarnings("unchecked")
225221
public void process(GetResponse getResponse) {
@@ -393,6 +389,11 @@ private void assertDeathReason(List<Object> death, int num,
393389
}
394390

395391
private static interface WithResponse {
392+
static final WithResponse NULL = new WithResponse() {
393+
public void process(GetResponse getResponse) {
394+
}
395+
};
396+
396397
public void process(GetResponse response);
397398
}
398399
}

0 commit comments

Comments
 (0)