lukemin89 commented on a change in pull request #11263: [BEAM-9325] Override
proper write method in UnownedOutputStream
URL: https://github.com/apache/beam/pull/11263#discussion_r401075112
##########
File path:
sdks/java/core/src/test/java/org/apache/beam/sdk/util/UnownedOutputStreamTest.java
##########
@@ -53,4 +56,22 @@ public void testClosingThrows() throws Exception {
expectedException.expectMessage("Caller does not own the underlying");
os.close();
}
+
+ @Test
+ public void testWrite() throws IOException {
+ ByteArrayOutputStream expected = new ByteArrayOutputStream();
+ ByteArrayOutputStream actual = new ByteArrayOutputStream();
+ UnownedOutputStream osActual = new UnownedOutputStream(actual);
+
+ byte[] data0 = "Hello World!".getBytes(StandardCharsets.UTF_8);
+ byte[] data1 = "Welcome!".getBytes(StandardCharsets.UTF_8);
+
+ expected.write(data0, 0, data0.length);
+ osActual.write(data0, 0, data0.length);
+
+ expected.write(data1, 0, data1.length);
+ osActual.write(data1, 0, data1.length);
+
+ assertArrayEquals(expected.toByteArray(), actual.toByteArray());
Review comment:
Added CallCountOutput Stream. Testing the proper number of call count.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services