コード例 #1
0
 @Test
 public void test_no_header() throws Exception {
   HeaderParser parser =
       new HeaderParser(
           new FileContent(
               new File("src/test/resources/doc/doc1.txt"), System.getProperty("file.encoding")),
           HeaderType.TEXT.getDefinition(),
           new String[] {"copyright"});
   assertFalse(parser.gotAnyHeader());
 }
コード例 #2
0
 @Test
 public void test_has_header2() throws Exception {
   HeaderParser parser =
       new HeaderParser(
           new FileContent(
               new File("src/test/resources/doc/doc3.txt"), System.getProperty("file.encoding")),
           HeaderType.TEXT.getDefinition(),
           new String[] {"copyright"});
   assertTrue(parser.gotAnyHeader());
   assertEquals(parser.getBeginPosition(), 0);
   assertEquals(parser.getEndPosition(), 49);
 }