|
1 | 1 | package com.github.dockerjava.core.command; |
2 | 2 |
|
| 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; |
3 | 10 | import static org.testng.Assert.assertEquals; |
4 | 11 | import static org.testng.Assert.assertFalse; |
5 | 12 |
|
6 | 13 | import java.util.ArrayList; |
7 | 14 | import java.util.Iterator; |
| 15 | +import java.util.LinkedHashSet; |
8 | 16 | import java.util.List; |
9 | 17 |
|
10 | 18 | import org.testng.annotations.AfterTest; |
@@ -39,18 +47,17 @@ public void deleteDockerContainerImage() throws Exception { |
39 | 47 |
|
40 | 48 | @Test |
41 | 49 | public void canCloseFrameReaderAndReadExpectedLines() throws Exception { |
42 | | - |
43 | 50 | // wait for the container to be successfully executed |
44 | 51 | int exitCode = dockerClient.waitContainerCmd(dockerfileFixture.getContainerId()) |
45 | 52 | .exec(new WaitContainerResultCallback()).awaitStatusCode(); |
46 | 53 | assertEquals(0, exitCode); |
47 | 54 |
|
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)); |
54 | 61 | } |
55 | 62 |
|
56 | 63 | private List<Frame> getLoggingFrames() throws Exception { |
|
0 commit comments