@@ -262,6 +262,7 @@ public void waitUntilBrokerAvailableIfNecessaryShouldReturnTrueOnceEnoughBrokers
262262
263263 @ Test
264264 public void createConnectionAddressesNotUsedWhenNoUriList () throws Exception {
265+ when (factory .newConnection (anyString ())).thenReturn (connection );
265266 MulticastSet multicastSet = getMulticastSet (new ArrayList <>());
266267 multicastSet .createConnection ("connection-1" );
267268 assertThat (multicastSet .createConfigurationConnections ()).hasSize (1 );
@@ -271,6 +272,7 @@ public void createConnectionAddressesNotUsedWhenNoUriList() throws Exception {
271272
272273 @ Test
273274 public void createConnectionFromOneUri () throws Exception {
275+ when (factory .newConnection (anyList (), anyString ())).thenReturn (connection );
274276 MulticastSet multicastSet = getMulticastSet (Arrays .asList ("amqp://host1:5673" ));
275277 multicastSet .createConnection ("connection-1" );
276278 ArgumentCaptor <List <Address >> addresses = addressesArgumentCaptor ();
@@ -285,6 +287,7 @@ public void createConnectionFromOneUri() throws Exception {
285287
286288 @ Test
287289 public void createConfigurationConnectionFromOneUri () throws Exception {
290+ when (factory .newConnection (anyList (), anyString ())).thenReturn (connection );
288291 MulticastSet multicastSet = getMulticastSet (Arrays .asList ("amqp://host1:5673" ));
289292 assertThat (multicastSet .createConfigurationConnections ()).hasSize (1 );
290293 ArgumentCaptor <List <Address >> addresses = addressesArgumentCaptor ();
@@ -300,6 +303,7 @@ public void createConfigurationConnectionFromOneUri() throws Exception {
300303
301304 @ Test
302305 public void createConnectionFromSeveralUrisShufflingShouldHappen () throws Exception {
306+ when (factory .newConnection (anyList (), anyString ())).thenReturn (connection );
303307 List <String > uris =
304308 IntStream .range (0 , 100 ).mapToObj (i -> "amqp://host" + i ).collect (Collectors .toList ());
305309 MulticastSet multicastSet = getMulticastSet (uris );
@@ -323,6 +327,7 @@ public void createConnectionFromSeveralUrisShufflingShouldHappen() throws Except
323327 @ Test
324328 public void createConfigurationConnectionFromSeveralUrisConnectionShouldBeSpread ()
325329 throws Exception {
330+ when (factory .newConnection (anyList (), anyString ())).thenReturn (connection );
326331 int hostCount = 5 ;
327332 List <String > uris =
328333 IntStream .range (0 , hostCount )
0 commit comments