Fixed all issues in boundary stream
This commit is contained in:
parent
43dc9a11cb
commit
f2939f819f
9 changed files with 139 additions and 67 deletions
31
test/zutil/io/IOUtilTest.java
Executable file
31
test/zutil/io/IOUtilTest.java
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
package zutil.io;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Created by Ziver on 2016-07-12.
|
||||
*/
|
||||
public class IOUtilTest {
|
||||
|
||||
@Test
|
||||
public void readLine() throws IOException {
|
||||
StringInputStream in = new StringInputStream("test\ntest2\ntest3");
|
||||
|
||||
assertEquals("test", IOUtil.readLine(in));
|
||||
assertEquals("test2", IOUtil.readLine(in));
|
||||
assertEquals("test3", IOUtil.readLine(in));
|
||||
assertEquals(null, IOUtil.readLine(in));
|
||||
}
|
||||
@Test
|
||||
public void readLineCarriageReturn() throws IOException {
|
||||
StringInputStream in = new StringInputStream("test\r\ntest2\r\n");
|
||||
|
||||
assertEquals("test", IOUtil.readLine(in));
|
||||
assertEquals("test2", IOUtil.readLine(in));
|
||||
assertEquals(null, IOUtil.readLine(in));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue