creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1549179 - /creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/annotation/LicenceAppenderTest.java
Date Sun, 08 Dec 2013 20:00:10 GMT
Author: rdonkin
Date: Sun Dec  8 20:00:10 2013
New Revision: 1549179

URL: http://svn.apache.org/r1549179
Log:
Add test: testBOMInputStreamRead

Modified:
    creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/annotation/LicenceAppenderTest.java

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/annotation/LicenceAppenderTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/annotation/LicenceAppenderTest.java?rev=1549179&r1=1549178&r2=1549179&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/annotation/LicenceAppenderTest.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/annotation/LicenceAppenderTest.java
Sun Dec  8 20:00:10 2013
@@ -23,9 +23,11 @@ import static org.junit.Assert.assertFal
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.Writer;
 import java.util.Random;
 
@@ -979,4 +981,27 @@ public class LicenceAppenderTest {
 		Assert.assertEquals("##" + System.getProperty("line.separator"),
 				appender.getLine(type, ""));
 	}
+
+	/**
+	 * Test bom input stream read.
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	@Test
+	public void testBOMInputStreamRead() throws IOException {
+		String document = qualify("tmp.apt");
+		FileCreator creator = new FileCreator() {
+			public void createFile(final Writer writer) throws IOException {
+				writer.write("A Simple APT file");
+				writer.write(" This file contains nothing\n");
+				writer.write(" of any importance\n");
+			}
+		};
+		createTestFile(document, creator);
+		InputStream fis = new FileInputStream(new File(document));
+		BOMInputStream bomInputStream = new BOMInputStream(fis);
+		Assert.assertEquals(65, bomInputStream.read());
+		bomInputStream.close();
+	}
 }



Mime
View raw message