Skip to content

Commit 928755d

Browse files
committed
BAEL-1609 Added test for CountingOutputStream
1 parent 3c4b0fb commit 928755d

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.baeldung.guava;
2+
3+
import static org.junit.Assert.assertEquals;
4+
5+
import java.io.ByteArrayOutputStream;
6+
7+
import org.junit.Test;
8+
9+
import com.google.common.io.CountingOutputStream;
10+
11+
public class GuavaCountingOutputStreamTest {
12+
13+
@Test
14+
public void givenData_whenWrittenToStream_thenGetCorrectCount() throws Exception {
15+
ByteArrayOutputStream out = new ByteArrayOutputStream();
16+
CountingOutputStream cos = new CountingOutputStream(out);
17+
18+
byte[] data = new byte[10];
19+
20+
cos.write(data);
21+
22+
assertEquals(10, cos.getCount());
23+
24+
}
25+
}

0 commit comments

Comments
 (0)