X Tutup
Skip to content

Commit cc25cce

Browse files
committed
Fix sync test to be async.
1 parent 75f8df7 commit cc25cce

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/test/java/com/github/dockerjava/core/command/FrameReaderITest.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
package com.github.dockerjava.core.command;
22

3+
import static org.hamcrest.MatcherAssert.assertThat;
4+
import static org.hamcrest.Matchers.contains;
5+
import static org.hamcrest.Matchers.containsInAnyOrder;
6+
import static org.hamcrest.Matchers.hasEntry;
7+
import static org.hamcrest.Matchers.hasProperty;
8+
import static org.hamcrest.Matchers.hasSize;
9+
import static org.hamcrest.Matchers.is;
310
import static org.testng.Assert.assertEquals;
411
import static org.testng.Assert.assertFalse;
512

613
import java.util.ArrayList;
714
import java.util.Iterator;
15+
import java.util.LinkedHashSet;
816
import java.util.List;
917

1018
import org.testng.annotations.AfterTest;
@@ -39,18 +47,17 @@ public void deleteDockerContainerImage() throws Exception {
3947

4048
@Test
4149
public void canCloseFrameReaderAndReadExpectedLines() throws Exception {
42-
4350
// wait for the container to be successfully executed
4451
int exitCode = dockerClient.waitContainerCmd(dockerfileFixture.getContainerId())
4552
.exec(new WaitContainerResultCallback()).awaitStatusCode();
4653
assertEquals(0, exitCode);
4754

48-
Iterator<Frame> response = getLoggingFrames().iterator();
49-
50-
assertEquals(response.next(), new Frame(StreamType.STDOUT, "to stdout\n".getBytes()));
51-
assertEquals(response.next(), new Frame(StreamType.STDERR, "to stderr\n".getBytes()));
52-
assertFalse(response.hasNext());
53-
55+
final List<Frame> loggingFrames = getLoggingFrames();
56+
final Frame outFrame = new Frame(StreamType.STDOUT, "to stdout\n".getBytes());
57+
final Frame errFrame = new Frame(StreamType.STDERR, "to stderr\n".getBytes());
58+
59+
assertThat(loggingFrames, containsInAnyOrder(outFrame, errFrame));
60+
assertThat(loggingFrames, hasSize(2));
5461
}
5562

5663
private List<Frame> getLoggingFrames() throws Exception {

0 commit comments

Comments
 (0)
X Tutup