Skip to content

Commit 278a3ac

Browse files
authored
Replace deprecated match methods (docker-java#2189)
1 parent 8a84051 commit 278a3ac

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

docker-java/src/test/java/com/github/dockerjava/cmd/ListContainersCmdIT.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
import static org.hamcrest.MatcherAssert.assertThat;
2727
import static org.hamcrest.Matchers.equalTo;
2828
import static org.hamcrest.Matchers.hasItem;
29+
import static org.hamcrest.Matchers.hasSize;
2930
import static org.hamcrest.Matchers.is;
3031
import static org.hamcrest.Matchers.emptyString;
31-
import static org.hamcrest.Matchers.isOneOf;
3232
import static org.hamcrest.Matchers.not;
3333
import static org.hamcrest.Matchers.notNullValue;
34+
import static org.hamcrest.Matchers.oneOf;
3435
import static org.hamcrest.Matchers.startsWith;
3536
import static org.junit.Assert.assertEquals;
3637
import static org.testinfected.hamcrest.jpa.PersistenceMatchers.hasField;
@@ -161,8 +162,8 @@ public void testNameFilter() {
161162
.exec();
162163

163164
assertThat(filteredContainers.size(), is(2));
164-
assertThat(filteredContainers.get(0).getId(), isOneOf(id1, id2));
165-
assertThat(filteredContainers.get(1).getId(), isOneOf(id1, id2));
165+
assertThat(filteredContainers.get(0).getId(), is(oneOf(id1, id2)));
166+
assertThat(filteredContainers.get(1).getId(), is(oneOf(id1, id2)));
166167
}
167168

168169
@Test
@@ -184,8 +185,8 @@ public void testIdsFilter() {
184185
.exec();
185186

186187
assertThat(filteredContainers.size(), is(2));
187-
assertThat(filteredContainers.get(0).getId(), isOneOf(id1, id2));
188-
assertThat(filteredContainers.get(1).getId(), isOneOf(id1, id2));
188+
assertThat(filteredContainers.get(0).getId(), is(oneOf(id1, id2)));
189+
assertThat(filteredContainers.get(1).getId(), is(oneOf(id1, id2)));
189190
}
190191

191192
@Test
@@ -219,7 +220,7 @@ public void shouldFilterByRunningStatus() {
219220
.withStatusFilter(singletonList("running"))
220221
.exec();
221222

222-
assertThat(filteredContainers.size(), is(1));
223+
assertThat(filteredContainers, hasSize(1));
223224
assertThat(filteredContainers.get(0).getId(), is(containerId));
224225
}
225226

@@ -239,7 +240,7 @@ public void shouldFilterByPausedStatus() {
239240
.withStatusFilter(singletonList("paused"))
240241
.exec();
241242

242-
assertThat(filteredContainers.size(), is(1));
243+
assertThat(filteredContainers, hasSize(1));
243244
assertThat(filteredContainers.get(0).getId(), is(containerId));
244245
}
245246

@@ -260,7 +261,7 @@ public void shouldFilterByExitedStatus() throws InterruptedException {
260261
.withStatusFilter(singletonList("exited"))
261262
.exec();
262263

263-
assertThat(filteredContainers.size(), is(1));
264+
assertThat(filteredContainers, hasSize(1));
264265
assertThat(filteredContainers.get(0).getId(), is(containerId));
265266
}
266267

@@ -289,7 +290,7 @@ public void testVolumeFilter() {
289290
.withVolumeFilter(singletonList("TestFilterVolume"))
290291
.exec();
291292

292-
assertThat(filteredContainers.size(), is(1));
293+
assertThat(filteredContainers, hasSize(1));
293294
assertThat(filteredContainers.get(0).getId(), is(id));
294295
}
295296

0 commit comments

Comments
 (0)