@Test
public void testSimpleTextExtractor() throws Exception {

    String message =
        "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();
    PrintStream out = System.out;
    System.setOut(new PrintStream(buffer, true, UTF_8.name()));
    File file = new File("target", "test.txt");
    FileUtils.writeStringToFile(file, message, UTF_8);
    SimpleTextExtractor.main(new String[] { file.getPath() });
    file.delete();
    System.setOut(out);
    assertEquals(message, buffer.toString(UTF_8.name()).trim());
}