You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ni...@apache.org on 2015/08/16 22:31:17 UTC
svn commit: r1696164 -
/tika/trunk/tika-example/src/test/java/org/apache/tika/example/SimpleTextExtractorTest.java
Author: nick
Date: Sun Aug 16 20:31:17 2015
New Revision: 1696164
URL: http://svn.apache.org/r1696164
Log:
Tweak text to avoid a false match from the tika-core test dummy mimetype, and try to make constants use clearer
Modified:
tika/trunk/tika-example/src/test/java/org/apache/tika/example/SimpleTextExtractorTest.java
Modified: tika/trunk/tika-example/src/test/java/org/apache/tika/example/SimpleTextExtractorTest.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-example/src/test/java/org/apache/tika/example/SimpleTextExtractorTest.java?rev=1696164&r1=1696163&r2=1696164&view=diff
==============================================================================
--- tika/trunk/tika-example/src/test/java/org/apache/tika/example/SimpleTextExtractorTest.java (original)
+++ tika/trunk/tika-example/src/test/java/org/apache/tika/example/SimpleTextExtractorTest.java Sun Aug 16 20:31:17 2015
@@ -29,21 +29,22 @@ public class SimpleTextExtractorTest {
@Test
public void testSimpleTextExtractor() throws Exception {
String message =
- "Hello, World! This is simple UTF-8 text content written"
- + " in English to test autodetection of the character"
- + " encoding of the input stream.";
+ "This is Tika - Hello, World! This is simple UTF-8 text"
+ + " content written in English to test autodetection of"
+ + " the character encoding of the input stream.";
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ String UTF8 = Charsets.UTF_8.name();
PrintStream out = System.out;
- System.setOut(new PrintStream(buffer, true, Charsets.UTF_8.name()));
+ System.setOut(new PrintStream(buffer, true, UTF8));
File file = new File("target", "test.txt");
- FileUtils.writeStringToFile(file, message, "utf-8");
+ FileUtils.writeStringToFile(file, message, UTF8);
SimpleTextExtractor.main(new String[] { file.getPath() });
file.delete();
System.setOut(out);
- assertEquals(message, buffer.toString(Charsets.UTF_8.name()).trim());
+ assertEquals(message, buffer.toString(UTF8).trim());
}
}