COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 29 | @Test |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 30 | public void output() throws Exception { |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 31 | // I don't like "test all at once" tests either, but the class |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 32 | // is soo trivial |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 33 | ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 34 | CountingOutputStream o = new CountingOutputStream(bos); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 35 | o.write(1); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 36 | assertEquals(1, o.getBytesWritten()); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 37 | o.write(new byte[] { 2, 3 }); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 38 | assertEquals(3, o.getBytesWritten()); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 39 | o.write(new byte[] { 2, 3, 4, 5, }, 2, 1); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 40 | assertEquals(4, o.getBytesWritten()); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 41 | o.count(-1); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 42 | assertEquals(4, o.getBytesWritten()); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 43 | o.count(-2); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 44 | assertEquals(2, o.getBytesWritten()); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 45 | o.close(); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 46 | assertArrayEquals(new byte[] { 1, 2, 3, 4 }, bos.toByteArray()); |
COMPRESS_1.3_RC2 | Wed Oct 26 10:56:25 UTC 2011 | cb384b | 47 | } |