Fix race condition in MixedDispatchConfigTests

This commit is contained in:
Artem Bilan
2021-02-26 15:06:30 -05:00
parent be34fb6866
commit df3fc4c9a6

View File

@@ -32,10 +32,8 @@ import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InOrder;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -84,11 +82,6 @@ public class MixedDispatcherConfigurationScenarioTests {
@Autowired
private ConfigurableApplicationContext ac;
@BeforeEach
public void initialize() {
Mockito.reset(this.exceptionRegistry, this.handlerA, this.handlerB, this.handlerC);
}
@Test
public void noFailoverNoLoadBalancing() {
DirectChannel channel = (DirectChannel) ac.getBean("noLoadBalancerNoFailover");
@@ -158,9 +151,9 @@ public class MixedDispatcherConfigurationScenarioTests {
doAnswer(invocation -> {
RuntimeException e = new RuntimeException();
allDone.countDown();
failed.set(true);
exceptionRegistry.add(e);
allDone.countDown();
throw e;
}).when(handlerA).handleMessage(message);