Skip to content

Commit 191c091

Browse files
committed
Use Matchers in test
1 parent eb53845 commit 191c091

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/java/com/rabbitmq/jms/admin/RMQConnectionFactoryTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.rabbitmq.client.AddressResolver;
77
import com.rabbitmq.client.Connection;
88
import com.rabbitmq.client.ConnectionFactory;
9+
import org.hamcrest.Matchers;
910
import org.junit.Before;
1011
import org.junit.Test;
1112

@@ -20,9 +21,14 @@
2021
import java.util.concurrent.ExecutorService;
2122

2223
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;
2328
import static org.junit.Assert.assertEquals;
2429
import static org.junit.Assert.assertFalse;
2530
import static org.junit.Assert.assertNotNull;
31+
import static org.junit.Assert.assertThat;
2632
import static org.junit.Assert.assertTrue;
2733
import static org.mockito.Mockito.mock;
2834

@@ -251,8 +257,7 @@ public void shouldUseSingleAddressWhenSingleUri() throws Exception {
251257
rmqCf.createConnection("guest", "guest");
252258
assertNotNull(passedInAddressResolver);
253259
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))));
256261
// don't check host, as there can be some DNS resolution happening
257262
assertEquals(10000, resolved.get(0).getPort());
258263
}

0 commit comments

Comments
 (0)