Fix BrokerRunning for skipping tests

The regression after https://github.com/spring-projects/spring-amqp/issues/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`**
This commit is contained in:
Artem Bilan
2020-05-26 16:14:07 -04:00
parent fd61adc090
commit 4ac89e4701

View File

@@ -17,6 +17,7 @@
package org.springframework.amqp.rabbit.junit;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeNoException;
import java.util.Map;
@@ -58,9 +59,10 @@ import com.rabbitmq.client.ConnectionFactory;
*
* @author Dave Syer
* @author Gary Russell
* @author Artem Bilan
*
* @since 1.7
* @see org.junit.internal.AssumptionViolatedException
*
*/
public final class BrokerRunning extends TestWatcher {
@@ -125,7 +127,7 @@ public final class BrokerRunning extends TestWatcher {
* @return a new rule that assumes an existing broker with the management plugin with
* the provided queues declared (and emptied if needed)..
*/
public static BrokerRunning isBrokerAndManagementRunningWithEmptyQueues(String...queues) {
public static BrokerRunning isBrokerAndManagementRunningWithEmptyQueues(String... queues) {
return new BrokerRunning(true, true, queues);
}
@@ -272,6 +274,9 @@ public final class BrokerRunning extends TestWatcher {
if (fatal()) {
fail("RabbitMQ Broker is required, but not available");
}
else {
assumeNoException(e);
}
}
return super.apply(base, description);
}