|
6 | 6 | import com.rabbitmq.client.AddressResolver; |
7 | 7 | import com.rabbitmq.client.Connection; |
8 | 8 | import com.rabbitmq.client.ConnectionFactory; |
| 9 | +import org.hamcrest.Matchers; |
9 | 10 | import org.junit.Before; |
10 | 11 | import org.junit.Test; |
11 | 12 |
|
|
20 | 21 | import java.util.concurrent.ExecutorService; |
21 | 22 |
|
22 | 23 | import static java.util.Arrays.asList; |
| 24 | +import static org.hamcrest.Matchers.both; |
| 25 | +import static org.hamcrest.Matchers.greaterThanOrEqualTo; |
| 26 | +import static org.hamcrest.Matchers.is; |
| 27 | +import static org.hamcrest.Matchers.lessThanOrEqualTo; |
23 | 28 | import static org.junit.Assert.assertEquals; |
24 | 29 | import static org.junit.Assert.assertFalse; |
25 | 30 | import static org.junit.Assert.assertNotNull; |
| 31 | +import static org.junit.Assert.assertThat; |
26 | 32 | import static org.junit.Assert.assertTrue; |
27 | 33 | import static org.mockito.Mockito.mock; |
28 | 34 |
|
@@ -251,8 +257,7 @@ public void shouldUseSingleAddressWhenSingleUri() throws Exception { |
251 | 257 | rmqCf.createConnection("guest", "guest"); |
252 | 258 | assertNotNull(passedInAddressResolver); |
253 | 259 | List<Address> resolved = passedInAddressResolver.getAddresses(); |
254 | | - assertTrue(resolved.size() >= 1); |
255 | | - assertTrue(resolved.size() <= 2); |
| 260 | + assertThat(resolved.size(), is(both(greaterThanOrEqualTo(1)).and(lessThanOrEqualTo(2)))); |
256 | 261 | // don't check host, as there can be some DNS resolution happening |
257 | 262 | assertEquals(10000, resolved.get(0).getPort()); |
258 | 263 | } |
|
0 commit comments