Skip to content

Commit 73e2b20

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`** # Conflicts: # spring-rabbit-junit/src/main/java/org/springframework/amqp/rabbit/junit/BrokerRunning.java
1 parent 3aca171 commit 73e2b20

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 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

@@ -59,10 +60,10 @@
5960
*
6061
* @author Dave Syer
6162
* @author Gary Russell
63+
* @author Artem Bilan
6264
*
6365
* @since 1.7
64-
* @see Assume
65-
* @see org.junit.internal.AssumptionViolatedException
66+
*
6667
*/
6768
public final class BrokerRunning extends TestWatcher {
6869

@@ -127,7 +128,7 @@ public static BrokerRunning isBrokerAndManagementRunning() {
127128
* @return a new rule that assumes an existing broker with the management plugin with
128129
* the provided queues declared (and emptied if needed)..
129130
*/
130-
public static BrokerRunning isBrokerAndManagementRunningWithEmptyQueues(String...queues) {
131+
public static BrokerRunning isBrokerAndManagementRunningWithEmptyQueues(String... queues) {
131132
return new BrokerRunning(true, true, queues);
132133
}
133134

@@ -274,6 +275,9 @@ public Statement apply(Statement base, Description description) {
274275
if (fatal()) {
275276
fail("RabbitMQ Broker is required, but not available");
276277
}
278+
else {
279+
assumeNoException(e);
280+
}
277281
}
278282
return super.apply(base, description);
279283
}

0 commit comments

Comments
 (0)