Skip to content

Commit 4ac89e4

Browse files
committed
Fix BrokerRunning for skipping tests
The regression after #1190 The `assumeNoException(e)` was missed in the `BrokerRunning` when we don't have a locally ran RabbitMQ and no requirement. With the `assumeNoException(e)` test are skipped with positive outcome **Cherry-pick to `2.2.x`**
1 parent fd61adc commit 4ac89e4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

spring-rabbit-junit/src/main/java/org/springframework/amqp/rabbit/junit/BrokerRunning.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.amqp.rabbit.junit;
1818

1919
import static org.junit.Assert.fail;
20+
import static org.junit.Assume.assumeNoException;
2021

2122
import java.util.Map;
2223

@@ -58,9 +59,10 @@
5859
*
5960
* @author Dave Syer
6061
* @author Gary Russell
62+
* @author Artem Bilan
6163
*
6264
* @since 1.7
63-
* @see org.junit.internal.AssumptionViolatedException
65+
*
6466
*/
6567
public final class BrokerRunning extends TestWatcher {
6668

@@ -125,7 +127,7 @@ public static BrokerRunning isBrokerAndManagementRunning() {
125127
* @return a new rule that assumes an existing broker with the management plugin with
126128
* the provided queues declared (and emptied if needed)..
127129
*/
128-
public static BrokerRunning isBrokerAndManagementRunningWithEmptyQueues(String...queues) {
130+
public static BrokerRunning isBrokerAndManagementRunningWithEmptyQueues(String... queues) {
129131
return new BrokerRunning(true, true, queues);
130132
}
131133

@@ -272,6 +274,9 @@ public Statement apply(Statement base, Description description) {
272274
if (fatal()) {
273275
fail("RabbitMQ Broker is required, but not available");
274276
}
277+
else {
278+
assumeNoException(e);
279+
}
275280
}
276281
return super.apply(base, description);
277282
}

0 commit comments

Comments
 (0)