Skip to content

Commit ccede57

Browse files
committed
add tests for UnixStreamImpl
1 parent c4a3d56 commit ccede57

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

src/test/java/io/github/benas/unixstream/UnixStreamImplTest.java

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,50 @@ public class UnixStreamImplTest {
2121

2222
private Stream<String> stream;
2323

24+
private UnixStream<String> unixStream;
25+
2426
@Before
2527
public void setUp() {
2628
stream = Stream.of("id,name", "1,foo", "2,bar");
2729
}
2830

31+
@Test
32+
public void compact() throws Exception {
33+
stream = Stream.of(" f o o ");
34+
unixStream = new UnixStreamImpl<>(stream);
35+
36+
assertThat(unixStream.compact()).containsExactly("foo");
37+
}
38+
39+
@Test
40+
public void concat() throws Exception {
41+
stream = Stream.of("foo");
42+
unixStream = new UnixStreamImpl<>(stream);
43+
44+
assertThat(unixStream.concat(Stream.of("bar"))).containsExactly("foo", "bar");
45+
}
46+
47+
@Test
48+
public void cut() throws Exception {
49+
stream = Stream.of("1;foo");
50+
unixStream = new UnixStreamImpl<>(stream);
51+
52+
assertThat(unixStream.cut(";", 2)).containsExactly("foo");
53+
}
54+
55+
@Test
56+
public void dos2unix() throws Exception {
57+
stream = Stream.of("a\r\n", "b\r\nc\r\n");
58+
unixStream = new UnixStreamImpl<>(stream);
59+
60+
assertThat(unixStream.dos2unix()).containsExactly("a\n", "b\nc\n");
61+
}
62+
63+
@Test
64+
public void getShouldReturnTheOriginalStream() throws Exception {
65+
assertThat(UnixStream.unixify(stream).get()).isEqualTo(stream);
66+
}
67+
2968
@Test
3069
public void integrationTest1() throws IOException {
3170
List<String> strings = UnixStream.unixify(stream)
@@ -62,8 +101,4 @@ public void integrationTest3() throws IOException {
62101
assertThat(items).isNotNull().isNotEmpty().hasSize(2).containsExactly("name", "bar");
63102
}
64103

65-
@Test
66-
public void getShouldReturnTheOriginalStream() throws Exception {
67-
assertThat(UnixStream.unixify(stream).get()).isEqualTo(stream);
68-
}
69104
}

0 commit comments

Comments
 (0)