1 19 20 package com.izforge.izpack.compiler; 21 22 import java.io.File ; 23 import java.io.FileOutputStream ; 24 import java.io.IOException ; 25 26 import junit.framework.TestCase; 27 28 public class ByteCountingOutputStreamTest extends TestCase 29 { 30 31 public void testWriting() throws IOException 32 { 33 File temp = File.createTempFile("foo", "bar"); 34 FileOutputStream fout = new FileOutputStream (temp); 35 ByteCountingOutputStream out = new ByteCountingOutputStream(fout); 36 37 byte[] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; 38 out.write(data); 39 out.write(data, 3, 2); 40 out.write(1024); 41 out.close(); 42 43 TestCase.assertEquals(16, out.getByteCount()); 44 } 45 46 } 47 | Popular Tags |