-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathParallelBlockInputStreamTest.java
More file actions
29 lines (25 loc) · 1.02 KB
/
Copy pathParallelBlockInputStreamTest.java
File metadata and controls
29 lines (25 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package crosby.binary;
import crosby.binary.file.ParallelBlockInputStream;
import org.junit.Assert;
import org.junit.Test;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* Verifies that ParallelBlockInputStream still delivers blocks to the adaptor
* one at a time, in file order, producing output identical to the sequential
* BlockInputStream reader (see ReadFileTest).
*/
public class ParallelBlockInputStreamTest {
@Test
public void testParallel() throws Exception {
try (InputStream input = ReadFileTest.class.getResourceAsStream("/sample.pbf");
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
ParallelBlockInputStream blockInput = new ParallelBlockInputStream(
input, new ReadFileTest.TestBinaryParser(printWriter), 4)) {
blockInput.process();
Assert.assertEquals(ReadFileTest.EXPECTED, stringWriter.toString());
}
}
}