X Tutup
Skip to content

Commit e4f3884

Browse files
committed
Replace deprecated match methods
diff --git a/docker-java/src/test/java/com/github/dockerjava/cmd/ListContainersCmdIT.java b/docker-java/src/test/java/com/github/dockerjava/cmd/ListContainersCmdIT.java index c03df2a..3066767 100644 --- a/docker-java/src/test/java/com/github/dockerjava/cmd/ListContainersCmdIT.java +++ b/docker-java/src/test/java/com/github/dockerjava/cmd/ListContainersCmdIT.java @@ -26,11 +26,12 @@ import static java.util.Collections.singletonList; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.emptyString; -import static org.hamcrest.Matchers.isOneOf; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.oneOf; import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; import static org.testinfected.hamcrest.jpa.PersistenceMatchers.hasField; @@ -161,8 +162,8 @@ public class ListContainersCmdIT extends CmdIT { .exec(); assertThat(filteredContainers.size(), is(2)); - assertThat(filteredContainers.get(0).getId(), isOneOf(id1, id2)); - assertThat(filteredContainers.get(1).getId(), isOneOf(id1, id2)); + assertThat(filteredContainers.get(0).getId(), is(oneOf(id1, id2))); + assertThat(filteredContainers.get(1).getId(), is(oneOf(id1, id2))); } @test @@ -184,8 +185,8 @@ public class ListContainersCmdIT extends CmdIT { .exec(); assertThat(filteredContainers.size(), is(2)); - assertThat(filteredContainers.get(0).getId(), isOneOf(id1, id2)); - assertThat(filteredContainers.get(1).getId(), isOneOf(id1, id2)); + assertThat(filteredContainers.get(0).getId(), is(oneOf(id1, id2))); + assertThat(filteredContainers.get(1).getId(), is(oneOf(id1, id2))); } @test @@ -219,7 +220,7 @@ public class ListContainersCmdIT extends CmdIT { .withStatusFilter(singletonList("running")) .exec(); - assertThat(filteredContainers.size(), is(1)); + assertThat(filteredContainers, hasSize(1)); assertThat(filteredContainers.get(0).getId(), is(containerId)); } @@ -239,7 +240,7 @@ public class ListContainersCmdIT extends CmdIT { .withStatusFilter(singletonList("paused")) .exec(); - assertThat(filteredContainers.size(), is(1)); + assertThat(filteredContainers, hasSize(1)); assertThat(filteredContainers.get(0).getId(), is(containerId)); } @@ -260,7 +261,7 @@ public class ListContainersCmdIT extends CmdIT { .withStatusFilter(singletonList("exited")) .exec(); - assertThat(filteredContainers.size(), is(1)); + assertThat(filteredContainers, hasSize(1)); assertThat(filteredContainers.get(0).getId(), is(containerId)); } @@ -289,7 +290,7 @@ public class ListContainersCmdIT extends CmdIT { .withVolumeFilter(singletonList("TestFilterVolume")) .exec(); - assertThat(filteredContainers.size(), is(1)); + assertThat(filteredContainers, hasSize(1)); assertThat(filteredContainers.get(0).getId(), is(id)); }
1 parent 8a84051 commit e4f3884

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)
X Tutup