Debian Codegraph @

src/test/java/org/freehep/util/io/test/ASCII85OutputStreamTest.java

raw
1 // Copyright 2001-2005, FreeHEP.
2 package org.freehep.util.io.test;
3
4 import java.io.File;
5 import java.io.FileInputStream;
6 import java.io.FileOutputStream;
7 import java.io.InputStream;
8
9 import org.freehep.util.Assert;
10 import org.freehep.util.io.ASCII85OutputStream;
11
12 /**
13 * Test for ASCII85 Output Stream
14 *
15 * @author Mark Donszelmann
16 * @version $Id: ASCII85OutputStreamTest.java 8584 2006-08-10 23:06:37Z duns $
17 */
18 public class ASCII85OutputStreamTest extends AbstractStreamTest {
19
20 /**
21 * Test method for 'org.freehep.util.io.ASCII85OutputStream.write()'
22 * @throws Exception if ref file cannot be found
23 */
24 public void testWrite() throws Exception {
25 // this XML file needs to be fixed: eol-style=CRLF
26 File testFile = new File(testDir, "TestFile.xml");
27 File outFile = new File(outDir, "TestFile.a85");
28 File refFile = new File(refDir, "TestFile.a85");
29
30 ASCII85OutputStream out = new ASCII85OutputStream(new FileOutputStream(outFile));
31 // NOTE: read byte by byte, so the test will work on all platforms
32 InputStream in = new FileInputStream(testFile);
33 int b;
34 while ((b = in.read()) >= 0) {
35 out.write(b);
36 }
37 in.close();
38 out.close();
39
40 Assert.assertEquals(refFile, outFile, false);
41 }
42 }