/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.tika.parser.journal;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import static org.apache.tika.parser.journal.GrobidRESTParser.canRun;
import java.io.InputStream;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.parser.ParseContext;
import org.apache.tika.sax.BodyContentHandler;
import org.junit.Test;
import org.xml.sax.ContentHandler;

public class JournalParserTest {

  @Test
  public void testJournalParser() {
    String path = "/test-documents/testJournalParser.pdf";
    ContentHandler handler = new BodyContentHandler();
    Metadata metadata = new Metadata();
    
    assumeTrue(canRun());
    
    InputStream stream = JournalParserTest.class.getResourceAsStream(path);
    JournalParser jParser = new JournalParser();
    try {
      jParser.parse(stream, handler, metadata, new ParseContext());
    } catch (Exception e){
       e.printStackTrace();
       fail(e.getMessage());
    }

    assertNotNull(metadata.get("grobid:header_Title"));
  }
}

@@ -421,15 +421,15 @@
 t%0A *
-%0A *    
+ %3Cp%3E%0A *
  htt
@@ -470,16 +470,20 @@
 E-2.0%0A *
+ %3Cp%3E
 %0A * Unle
@@ -842,16 +842,86 @@
 urnal;%0A%0A
+import static org.apache.tika.parser.journal.GrobidRESTParser.canRun;%0A
 import s
@@ -1042,77 +1042,8 @@
 ue;%0A
-import static org.apache.tika.parser.journal.GrobidRESTParser.canRun;
 %0Aimp
@@ -1067,16 +1067,17 @@
 Stream;%0A
+%0A
 import o
@@ -1298,16 +1298,18 @@
  %7B%0A%0A
+  
   @Test%0A
   pu
@@ -1304,16 +1304,18 @@
   @Test%0A
+  
   public
@@ -1342,16 +1342,20 @@
 ser() %7B%0A
+    
     Stri
@@ -1405,16 +1405,20 @@
 r.pdf%22;%0A
+    
     Cont
@@ -1468,16 +1468,20 @@
 ();%0A    
+   
+ 
 Metadata
@@ -1508,21 +1508,21 @@
 data();%0A
+%0A
     
-%0A
     assu
@@ -1543,13 +1543,13 @@
 ));%0A
+%0A
     
-%0A
     
@@ -1624,16 +1624,20 @@
 h);%0A    
+   
+ 
 JournalP
@@ -1669,24 +1669,28 @@
 alParser();%0A
+    
     try %7B%0A  
@@ -1693,16 +1693,22 @@
 %7B%0A      
+  
+    
 jParser.
@@ -1757,24 +1757,28 @@
 Context());%0A
+    
     %7D catch 
@@ -1790,16 +1790,17 @@
 ption e)
+ 
 %7B%0A      
@@ -1800,16 +1800,21 @@
 %0A       
+ 
+    
 e.printS
@@ -1833,16 +1833,21 @@
 %0A       
+ 
+    
 fail(e.g
@@ -1868,11 +1868,19 @@
     
-%7D%0A%0A
+    %7D%0A%0A    
     
@@ -1931,14 +1931,16 @@
 tle%22));%0A
+  
   %7D%0A%7D%0A

fix indents/whitespace