|
7 | 7 | import org.apache.commons.io.IOUtils; |
8 | 8 | import org.apache.commons.io.LineIterator; |
9 | 9 | import org.apache.commons.lang.StringUtils; |
| 10 | +import org.hamcrest.Matcher; |
10 | 11 | import org.slf4j.Logger; |
11 | 12 | import org.slf4j.LoggerFactory; |
12 | 13 | import org.testng.Assert; |
@@ -124,10 +125,11 @@ public void testDockerInfo() throws DockerClientException { |
124 | 125 |
|
125 | 126 | @Test |
126 | 127 | public void testDockerSearch() throws DockerClientException { |
127 | | - List dockerSearch = dockerClient.search("busybox"); |
| 128 | + List<SearchItem> dockerSearch = dockerClient.search("busybox"); |
128 | 129 | LOG.info("Search returned" + dockerSearch.toString()); |
129 | 130 |
|
130 | | - assertThat(dockerSearch, hasItem(hasField("name", equalTo("busybox")))); |
| 131 | + Matcher matcher = hasItem(hasField("name", equalTo("busybox"))); |
| 132 | + assertThat(dockerSearch, matcher); |
131 | 133 |
|
132 | 134 | assertThat(filter(hasField("name", is("busybox")), dockerSearch).size(), equalTo(1)); |
133 | 135 | } |
@@ -176,7 +178,8 @@ public void testListContainers() throws DockerClientException { |
176 | 178 |
|
177 | 179 | List containers2 = dockerClient.listContainers(true); |
178 | 180 | assertThat(size + 1, is(equalTo(containers2.size()))); |
179 | | - assertThat(containers2, hasItem(hasField("id", startsWith(container1.id)))); |
| 181 | + Matcher matcher = hasItem(hasField("id", startsWith(container1.id))); |
| 182 | + assertThat(containers2, matcher); |
180 | 183 |
|
181 | 184 | List<Container> filteredContainers = filter(hasField("id", startsWith(container1.id)), containers2); |
182 | 185 | assertThat(filteredContainers.size(), is(equalTo(1))); |
@@ -411,7 +414,8 @@ public void removeContainer() throws DockerClientException { |
411 | 414 | dockerClient.removeContainer(container.id); |
412 | 415 |
|
413 | 416 | List containers2 = dockerClient.listContainers(true); |
414 | | - assertThat(containers2, not(hasItem(hasField("id", startsWith(container.id))))); |
| 417 | + Matcher matcher = not(hasItem(hasField("id", startsWith(container.id)))); |
| 418 | + assertThat(containers2, matcher); |
415 | 419 |
|
416 | 420 | } |
417 | 421 |
|
@@ -515,7 +519,8 @@ public void testRemoveImage() throws DockerClientException { |
515 | 519 | dockerClient.removeImage(imageId); |
516 | 520 |
|
517 | 521 | List containers = dockerClient.listContainers(true); |
518 | | - assertThat(containers, not(hasItem(hasField("id", startsWith(imageId))))); |
| 522 | + Matcher matcher = not(hasItem(hasField("id", startsWith(imageId)))); |
| 523 | + assertThat(containers, matcher); |
519 | 524 | } |
520 | 525 |
|
521 | 526 |
|
|
0 commit comments