You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2017/08/02 17:05:35 UTC

svn commit: r1803874 - /pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java

Author: tilman
Date: Wed Aug  2 17:05:34 2017
New Revision: 1803874

URL: http://svn.apache.org/viewvc?rev=1803874&view=rev
Log:
PDFBOX-2852: simplify code

Modified:
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java?rev=1803874&r1=1803873&r2=1803874&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java Wed Aug  2 17:05:34 2017
@@ -16,11 +16,11 @@
  */
 package org.apache.pdfbox.pdmodel.fdf;
 
+import java.io.File;
 import static org.junit.Assert.assertEquals;
 
 import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
+import java.net.URISyntaxException;
 import java.util.List;
 
 import org.junit.Test;
@@ -33,31 +33,13 @@ import org.junit.Test;
  */
 public class FDFAnnotationTest
 {
-
     @Test
-    public void loadXFDFAnnotations() throws IOException
+    public void loadXFDFAnnotations() throws IOException, URISyntaxException
     {
-        FDFDocument fdfDoc = null;
-        InputStream stream = null;
-        List<FDFAnnotation> fdfAnnots = new ArrayList<FDFAnnotation>();
-        try
-        {
-            stream = FDFAnnotationTest.class
-                    .getResourceAsStream("xfdf-test-document-annotations.xml");
-            fdfDoc = FDFDocument.loadXFDF(stream);
-            fdfAnnots = fdfDoc.getCatalog().getFDF().getAnnotations();
-            assertEquals(17, fdfAnnots.size());
-        }
-        finally
-        {
-            if (stream != null)
-            {
-                stream.close();
-            }
-            if (fdfDoc != null)
-            {
-                fdfDoc.close();
-            }
-        }
+        File f = new File(FDFAnnotationTest.class.getResource("xfdf-test-document-annotations.xml").toURI());
+        FDFDocument fdfDoc = FDFDocument.loadXFDF(f);
+        List<FDFAnnotation> fdfAnnots = fdfDoc.getCatalog().getFDF().getAnnotations();
+        assertEquals(17, fdfAnnots.size());
+        fdfDoc.close();
     }
-}
+}
\ No newline at end of file