Skip to content

Commit e818064

Browse files
Refactor
1 parent 881b3e2 commit e818064

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,20 @@ public void testExchangeRecoveryWithNoWait() throws IOException, InterruptedExce
167167
}
168168

169169
public void testClientNamedQueueRecovery() throws IOException, InterruptedException, TimeoutException {
170-
Channel ch = connection.createChannel();
171-
String q = "java-client.test.recovery.q1";
172-
declareClientNamedQueue(ch, q);
173-
closeAndWaitForRecovery();
174-
expectChannelRecovery(ch);
175-
expectQueueRecovery(ch, q);
176-
ch.queueDelete(q);
170+
testClientNamedQueueRecoveryWith("java-client.test.recovery.q1", false);
177171
}
178172

179173
public void testClientNamedQueueRecoveryWithNoWait() throws IOException, InterruptedException, TimeoutException {
174+
testClientNamedQueueRecoveryWith("java-client.test.recovery.q1-nowait", true);
175+
}
176+
177+
protected void testClientNamedQueueRecoveryWith(String q, boolean noWait) throws IOException, InterruptedException, TimeoutException {
180178
Channel ch = connection.createChannel();
181-
String q = "java-client.test.recovery.q1-nowait";
182-
declareClientNamedQueueNoWait(ch, q);
179+
if(noWait) {
180+
declareClientNamedQueueNoWait(ch, q);
181+
} else {
182+
declareClientNamedQueue(ch, q);
183+
}
183184
closeAndWaitForRecovery();
184185
expectChannelRecovery(ch);
185186
expectQueueRecovery(ch, q);

0 commit comments

Comments
 (0)