pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject pdfbox-jbig2 git commit: PDFBOX-3906: adjust unit tests to use external testfiles
Date Mon, 04 Dec 2017 18:40:11 GMT
Repository: pdfbox-jbig2
Updated Branches:
  refs/heads/master 6d652bf50 -> dbaef86d5


PDFBOX-3906: adjust unit tests to use external testfiles


Project: http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/repo
Commit: http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/commit/dbaef86d
Tree: http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/tree/dbaef86d
Diff: http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/diff/dbaef86d

Branch: refs/heads/master
Commit: dbaef86d5015c5c4eccb9c03b95524316afdd6f7
Parents: 6d652bf
Author: Andreas Lehmkühler <andreas@lehmi.de>
Authored: Mon Dec 4 19:39:53 2017 +0100
Committer: Andreas Lehmkühler <andreas@lehmi.de>
Committed: Mon Dec 4 19:39:53 2017 +0100

----------------------------------------------------------------------
 pom.xml                                         | 138 +++++++++++--------
 .../org/apache/pdfbox/jbig2/ChecksumTest.java   | 102 +++++++-------
 .../pdfbox/jbig2/JBIG2ImageReaderTest.java      |  38 +++--
 .../org/apache/pdfbox/jbig2/JBIG2PageTest.java  |  20 ++-
 .../jbig2/decoder/mmr/MMRDecompressorTest.java  |  44 +++---
 .../pdfbox/jbig2/image/BitmapsBlitTest.java     |  16 ++-
 .../pdfbox/jbig2/image/BitmapsChecksumTest.java |  81 ++++++-----
 .../jbig2/segments/GenericRegionTest.java       |  27 ++--
 .../jbig2/segments/HalftoneRegionTest.java      |   9 +-
 .../jbig2/segments/PageInformationTest.java     |   9 +-
 .../jbig2/segments/PatternDictionaryTest.java   |  25 +++-
 .../segments/RegionSegmentInformationTest.java  |   8 +-
 .../pdfbox/jbig2/segments/TextRegionTest.java   |  14 +-
 13 files changed, 312 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 21b73ec..7f6b2d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -229,65 +229,91 @@
 	</dependency>
     </dependencies>
 
-    <build>
-        <plugins>
-            <plugin>
-		<artifactId>maven-compiler-plugin</artifactId>
-		<configuration>
-			<source>1.7</source>
-			<target>1.7</target>
-			<debug>false</debug>
-			<optimize>true</optimize>
-			</configuration>
-            </plugin>
-            <plugin>
-		<artifactId>maven-release-plugin</artifactId>
-		<configuration>
-			<autoVersionSubmodules>true</autoVersionSubmodules>
-		        <!-- Keep changes in the local repo, push will be done afterwards -->
-		        <pushChanges>false</pushChanges>
-		        <localCheckout>true</localCheckout>
-		        <!-- Use a better name for the tag -->
-		        <tagNameFormat>${project.artifactId}-${project.version}</tagNameFormat>
-		</configuration>
-		<dependencies>
-			<dependency>
-			        <groupId>org.apache.maven.scm</groupId>
-			        <artifactId>maven-scm-provider-gitexe</artifactId>
-		        	<version>1.9</version>
-		        </dependency>
-		</dependencies>
-            </plugin>
+    <!-- enable the usage of external testfiles with -Dskip-external-testfiles=false  -->
+    <properties>
+        <skip-external-testfiles>true</skip-external-testfiles>
+    </properties>
+
+	<build>
+		<plugins>
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.7</source>
+					<target>1.7</target>
+					<debug>false</debug>
+					<optimize>true</optimize>
+				</configuration>
+			</plugin>
+			<plugin>
+				<artifactId>maven-release-plugin</artifactId>
+				<configuration>
+					<autoVersionSubmodules>true</autoVersionSubmodules>
+					<!-- Keep changes in the local repo, push will be done afterwards -->
+					<pushChanges>false</pushChanges>
+					<localCheckout>true</localCheckout>
+					<!-- Use a better name for the tag -->
+					<tagNameFormat>${project.artifactId}-${project.version}</tagNameFormat>
+				</configuration>
+				<dependencies>
+					<dependency>
+						<groupId>org.apache.maven.scm</groupId>
+						<artifactId>maven-scm-provider-gitexe</artifactId>
+						<version>1.9</version>
+					</dependency>
+				</dependencies>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-source-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>attach-sources</id>
+						<goals>
+							<goal>jar</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-source-plugin</artifactId>
+                <groupId>com.googlecode.maven-download-plugin</groupId>
+                <artifactId>download-maven-plugin</artifactId>
+                <version>1.3.0</version>
                 <executions>
-                   <execution>
-                      <id>attach-sources</id>
-                      <goals>
-                        <goal>jar</goal>
-                      </goals>
-                   </execution>
+                    <execution>
+                        <id>Testfiles</id>
+                        <phase>generate-test-resources</phase>
+                        <goals>
+                            <goal>wget</goal>
+                        </goals>
+                        <configuration>
+                            <skip>${skip-external-testfiles}</skip>
+                            <url>https://github.com/apache/pdfbox-testfiles/raw/master/jbig2/build-files/build-testfiles.zip</url>
+                            <unpack>true</unpack>
+                            <outputDirectory>${project.build.directory}/images</outputDirectory>
+                            <sha512>5185b59b4117d830a05a225e7e4b3a8239f249c78f6133204d62d510991daf769d287cd704ba91895964ff3df8722fb304d1e571f3b4d250e663a064c53a3091</sha512>
+                        </configuration>
+                    </execution>
                 </executions>
-            </plugin>
-	</plugins>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <groupId>org.apache.rat</groupId>
-                    <artifactId>apache-rat-plugin</artifactId>
-                    <version>0.11</version>
-                    <configuration>
-                        <excludes>
-                            <exclude>src/test/resources/images/*</exclude>
-                            <exclude>src/test/resources/images/arith/*</exclude>
-                            <exclude>src/test/resources/com/levigo/jbig2/github/*</exclude>
-                        </excludes>
-                    </configuration>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-   </build>
+            </plugin>			
+		</plugins>
+		<pluginManagement>
+			<plugins>
+				<plugin>
+					<groupId>org.apache.rat</groupId>
+					<artifactId>apache-rat-plugin</artifactId>
+					<version>0.11</version>
+					<configuration>
+						<excludes>
+							<exclude>src/test/resources/images/*</exclude>
+							<exclude>src/test/resources/images/arith/*</exclude>
+							<exclude>src/test/resources/com/levigo/jbig2/github/*</exclude>
+						</excludes>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
 
    <profiles>
         <profile>

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java b/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java
index 5ad235f..77b78bd 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/ChecksumTest.java
@@ -19,6 +19,8 @@ package org.apache.pdfbox.jbig2;
 
 import static org.junit.Assume.assumeTrue;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.InputStream;
 import java.security.MessageDigest;
 import java.util.Arrays;
@@ -43,98 +45,98 @@ public class ChecksumTest {
   public static Collection<Object[]> data() {
     return Arrays.asList(new Object[][]{
         {
-            "/images/042_1.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_1.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_2.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_2.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_3.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_3.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_4.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_4.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_5.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_5.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_6.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_6.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_7.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_7.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_8.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_8.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_9.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_9.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_10.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_10.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_11.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_11.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_12.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_12.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         },
         // { "/images/042_13.jb2",
         // "69-26-6629-1793-107941058147-58-79-37-31-79" },
         // { "/images/042_14.jb2",
         // "69-26-6629-1793-107941058147-58-79-37-31-79" },
         {
-            "/images/042_15.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_15.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_16.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_16.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_17.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_17.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_18.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_18.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_19.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_19.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_20.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_20.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_21.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_21.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_22.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_22.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_23.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_23.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_24.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_24.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/042_25.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
+            "target/images/042_25.jb2", "69-26-6629-1793-107941058147-58-79-37-31-79"
         }, {
-            "/images/amb_1.jb2", "58311272494-318210035-125100-344625-126-79"
+            "target/images/amb_1.jb2", "58311272494-318210035-125100-344625-126-79"
         }, {
-            "/images/amb_2.jb2", "58311272494-318210035-125100-344625-126-79"
+            "target/images/amb_2.jb2", "58311272494-318210035-125100-344625-126-79"
         }, {
-            "/images/002.jb2", "-12713-4587-92-651657111-57121-1582564895"
+            "src/test/resources/images/002.jb2", "-12713-4587-92-651657111-57121-1582564895"
         }, {
-            "/images/003.jb2", "-37-108-89-33-78-5019-966-96-124-9675-1-108-24"
+            "src/test/resources/images/003.jb2", "-37-108-89-33-78-5019-966-96-124-9675-1-108-24"
         }, {
-            "/images/004.jb2", "-10709436-24-59-48-217114-37-85-3126-24"
+            "target/images/004.jb2", "-10709436-24-59-48-217114-37-85-3126-24"
         }, {
-            "/images/005.jb2", "712610586-1224021396100112-102-77-1177851"
+            "src/test/resources/images/005.jb2", "712610586-1224021396100112-102-77-1177851"
         }, {
-            "/images/006.jb2", "-8719-116-83-83-35-3425-64-528667602154-25"
+            "src/test/resources/images/006.jb2", "-8719-116-83-83-35-3425-64-528667602154-25"
         }, {
-            "/images/007.jb2", "6171-125-109-20-128-71925295955793-127-41-122"
+            "target/images/007.jb2", "6171-125-109-20-128-71925295955793-127-41-122"
         }, {
-            "/images/sampledata_page1.jb2", "104-68-555325117-4757-48527676-9775-8432"
+            "target/images/sampledata_page1.jb2", "104-68-555325117-4757-48527676-9775-8432"
         }, {
-            "/images/sampledata_page2.jb2", "104-68-555325117-4757-48527676-9775-8432"
+            "target/images/sampledata_page2.jb2", "104-68-555325117-4757-48527676-9775-8432"
         }, {
-            "/images/sampledata_page3.jb2", "-7825-56-41-30-19-719536-3678580-61-2586"
+            "target/images/sampledata_page3.jb2", "-7825-56-41-30-19-719536-3678580-61-2586"
         }, {
-            "/images/20123110001.jb2", "60-96-101-2458-3335024-5468-5-11068-78-80"
+            "src/test/resources/images/20123110001.jb2", "60-96-101-2458-3335024-5468-5-11068-78-80"
         }, {
-            "/images/20123110002.jb2", "-28-921048181-117-48-96126-110-9-2865611113"
+            "src/test/resources/images/20123110002.jb2", "-28-921048181-117-48-96126-110-9-2865611113"
         }, {
-            "/images/20123110003.jb2", "-3942-239351-28-56-729169-5839122-439231"
+            "src/test/resources/images/20123110003.jb2", "-3942-239351-28-56-729169-5839122-439231"
         }, {
-            "/images/20123110004.jb2", "-49-101-28-20-57-4-24-17-9352104-106-118-122-122"
+            "src/test/resources/images/20123110004.jb2", "-49-101-28-20-57-4-24-17-9352104-106-118-122-122"
         }, {
-            "/images/20123110005.jb2", "-48221261779-94-838820-127-114110-2-88-80-106"
+            "src/test/resources/images/20123110005.jb2", "-48221261779-94-838820-127-114110-2-88-80-106"
         }, {
-            "/images/20123110006.jb2", "81-11870-63-30124-1614-45838-53-123-41639"
+            "src/test/resources/images/20123110006.jb2", "81-11870-63-30124-1614-45838-53-123-41639"
         }, {
-            "/images/20123110007.jb2", "12183-49124728346-29-124-9-10775-63-44116103"
+            "src/test/resources/images/20123110007.jb2", "12183-49124728346-29-124-9-10775-63-44116103"
         }, {
-            "/images/20123110008.jb2", "15-74-49-45958458-67-2545-96-119-122-60100-35"
+            "src/test/resources/images/20123110008.jb2", "15-74-49-45958458-67-2545-96-119-122-60100-35"
         }, {
-            "/images/20123110009.jb2", "36115-114-28-123-3-70-87-113-4197-8512396113-65"
+            "src/test/resources/images/20123110009.jb2", "36115-114-28-123-3-70-87-113-4197-8512396113-65"
         }, {
-            "/images/20123110010.jb2", "-109-1069-61-1576-67-43122406037-75-1091115"
+            "src/test/resources/images/20123110010.jb2", "-109-1069-61-1576-67-43122406037-75-1091115"
         }
     });
   }
@@ -151,20 +153,18 @@ public class ChecksumTest {
   public void compareChecksum() throws Throwable {
     int imageIndex = 1;
 
-    InputStream inputStream = getClass().getResourceAsStream(filepath);
+    final File inputFile = new File(filepath);
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    final InputStream inputStream = new FileInputStream(inputFile);
 
-    System.out.println("####################################");
-    System.out.println("File: " + filepath);
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);
 
     JBIG2Document doc = new JBIG2Document(iis);
 
-    long time = System.currentTimeMillis();
     Bitmap b = doc.getPage(imageIndex).getBitmap();
-    long duration = System.currentTimeMillis() - time;
 
     byte[] digest = MessageDigest.getInstance("MD5").digest(b.getByteArray());
 
@@ -173,8 +173,6 @@ public class ChecksumTest {
     {
         stringBuilder.append(toAppend);
     }
-    System.out.println("Completed decoding in " + duration + " ms");
-    System.out.println("####################################\n");
 
     Assert.assertEquals(checksum, stringBuilder.toString());
   }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java b/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java
index 3e75e8d..f4a087f 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/JBIG2ImageReaderTest.java
@@ -21,6 +21,8 @@ import static org.junit.Assume.assumeTrue;
 
 import java.awt.image.BufferedImage;
 import java.awt.image.Raster;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -56,12 +58,14 @@ public class JBIG2ImageReaderTest {
 
   @Test
   public void testRead() throws IOException, InvalidHeaderValueException, IntegerMaxValueException {
-    String filepath = "/images/042_1.jb2";
+
     int imageIndex = 0;
 
-    InputStream inputStream = getClass().getResourceAsStream(filepath);
+    final File inputFile = new File("target/images/042_1.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream imageInputStream = disf.getInputStream(inputStream);
@@ -79,12 +83,14 @@ public class JBIG2ImageReaderTest {
 
   @Test
   public void testReadRaster() throws IOException, InvalidHeaderValueException, IntegerMaxValueException {
-    String filepath = "/images/042_1.jb2";
+
     int imageIndex = 0;
 
-    InputStream inputStream = getClass().getResourceAsStream(filepath);
+    final File inputFile = new File("target/images/042_1.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream imageInputStream = disf.getInputStream(inputStream);
@@ -98,12 +104,14 @@ public class JBIG2ImageReaderTest {
 
   @Test
   public void testReadImageReadParamNull() throws IOException, InvalidHeaderValueException, IntegerMaxValueException {
-    String filepath = "/images/042_1.jb2";
-    int imageIndex = 0;
 
-    InputStream inputStream = getClass().getResourceAsStream(filepath);
+    int imageIndex = 0;
+    
+    final File inputFile = new File("target/images/042_1.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream imageInputStream = disf.getInputStream(inputStream);
@@ -117,12 +125,14 @@ public class JBIG2ImageReaderTest {
   @Test
   public void testReadRasterImageReadParamNull() throws IOException, InvalidHeaderValueException,
       IntegerMaxValueException {
-    String filepath = "/images/042_1.jb2";
-    int imageIndex = 0;
 
-    InputStream inputStream = getClass().getResourceAsStream(filepath);
+    int imageIndex = 0;
+    
+    final File inputFile = new File("target/images/042_1.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream imageInputStream = disf.getInputStream(inputStream);

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java b/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java
index 1fb6ae5..6c23b60 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/JBIG2PageTest.java
@@ -17,8 +17,12 @@
 
 package org.apache.pdfbox.jbig2;
 
+import static org.junit.Assume.assumeTrue;
+
 import java.awt.Rectangle;
 import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -44,10 +48,13 @@ public class JBIG2PageTest {
   @Test
   public void composeDisplayTest() throws IOException, JBIG2Exception {
 
-    String filepath = "/images/amb_1.jb2";
+    final File inputFile = new File("target/images/amb_1.jb2");
+    // skip test if input stream isn't available
+    assumeTrue(inputFile.exists());
+
     int pageNumber = 1;
 
-    InputStream is = getClass().getResourceAsStream(filepath);
+    InputStream is = new FileInputStream(inputFile);
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(is);
     JBIG2Document doc = new JBIG2Document(iis);
@@ -64,12 +71,13 @@ public class JBIG2PageTest {
     int runs = 40;
     long avg = 0;
 
-    String path = "/images/042_8.jb2";
-    int pageNumber = 1;
+    final File inputFile = new File("target/images/042_8.jb2");
+    // skip test if input stream isn't available
+    assumeTrue(inputFile.exists());
 
-    System.out.println("File: " + path);
+    int pageNumber = 1;
 
-    InputStream is = getClass().getResourceAsStream(path);
+    InputStream is = new FileInputStream(inputFile);
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(is);
 

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/decoder/mmr/MMRDecompressorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/decoder/mmr/MMRDecompressorTest.java b/src/test/java/org/apache/pdfbox/jbig2/decoder/mmr/MMRDecompressorTest.java
index 6931479..f8da8de 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/decoder/mmr/MMRDecompressorTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/decoder/mmr/MMRDecompressorTest.java
@@ -20,6 +20,8 @@ package org.apache.pdfbox.jbig2.decoder.mmr;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assume.assumeTrue;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -33,32 +35,30 @@ import org.junit.Test;
 
 public class MMRDecompressorTest {
 
-  @Test
+    @Test
     public void mmrDecodingTest() throws IOException, InvalidHeaderValueException
     {
-    final byte[] expected = new byte[]{
-        0, 0, 2, 34, 38, 102, -17, -1, 2, 102, 102, //
-        -18, -18, -17, -1, -1, 0, 2, 102, 102, 127, //
-        -1, -1, -1, 0, 0, 0, 4, 68, 102, 102, 127
-    };
-    final String filepath = "/images/sampledata.jb2";
+        final byte[] expected = new byte[] { 0, 0, 2, 34, 38, 102, -17, -1, 2, 102, 102, //
+                -18, -18, -17, -1, -1, 0, 2, 102, 102, 127, //
+                -1, -1, -1, 0, 0, 0, 4, 68, 102, 102, 127 };
 
-    final InputStream inputStream = getClass().getResourceAsStream(filepath);
-    // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+        final File inputFile = new File("target/images/sampledata.jb2");
+        // skip test if input stream isn't available
+        assumeTrue(inputFile.exists());
 
-    final DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    final ImageInputStream iis = disf.getInputStream(inputStream);
+        final InputStream inputStream = new FileInputStream(inputFile);
     
-    // Sixth Segment (number 5)
-    final SubInputStream sis = new SubInputStream(iis, 252, 38);
-    
-    final MMRDecompressor mmrd = new MMRDecompressor(16 * 4, 4, sis);
-    
-    final Bitmap b = mmrd.uncompress();
-    final byte[] actual = b.getByteArray();
+        final DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+        final ImageInputStream iis = disf.getInputStream(inputStream);
+
+        // Sixth Segment (number 5)
+        final SubInputStream sis = new SubInputStream(iis, 252, 38);
 
-    assertArrayEquals(expected, actual);
-    // new TestImage(b.getByteArray(), (int) b.getWidth(), (int) b.getHeight(), b.getRowStride());
-  }
+        final MMRDecompressor mmrd = new MMRDecompressor(16 * 4, 4, sis);
+
+        final Bitmap b = mmrd.uncompress();
+        final byte[] actual = b.getByteArray();
+    
+        assertArrayEquals(expected, actual);
+    }
 }

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsBlitTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsBlitTest.java b/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsBlitTest.java
index f6fe072..8e074fe 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsBlitTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsBlitTest.java
@@ -21,6 +21,8 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assume.assumeTrue;
 
 import java.awt.Rectangle;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -38,10 +40,13 @@ public class BitmapsBlitTest {
 
   @Test
   public void testCompleteBitmapTransfer() throws IOException, JBIG2Exception {
-    final InputStream inputStream = getClass().getResourceAsStream("/images/042_1.jb2");
+
+    final File inputFile = new File("target/images/042_1.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
 
+    final InputStream inputStream = new FileInputStream(inputFile);
+  
     final DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     final ImageInputStream iis = disf.getInputStream(inputStream);
 
@@ -59,9 +64,12 @@ public class BitmapsBlitTest {
 
   @Test
   public void test() throws IOException, JBIG2Exception {
-    final InputStream inputStream = getClass().getResourceAsStream("/images/042_1.jb2");
+
+    final File inputFile = new File("target/images/042_1.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    final InputStream inputStream = new FileInputStream(inputFile);
 
     final DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     final ImageInputStream iis = disf.getInputStream(inputStream);

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java b/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java
index 3f8ff01..1752341 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/image/BitmapsChecksumTest.java
@@ -28,7 +28,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
@@ -39,7 +38,6 @@ import javax.imageio.stream.ImageInputStream;
 
 import org.apache.pdfbox.jbig2.Bitmap;
 import org.apache.pdfbox.jbig2.JBIG2DocumentFacade;
-import org.apache.pdfbox.jbig2.JBIG2ImageReaderDemo;
 import org.apache.pdfbox.jbig2.PreconfiguredImageReadParam;
 import org.apache.pdfbox.jbig2.err.JBIG2Exception;
 import org.apache.pdfbox.jbig2.image.Bitmaps;
@@ -65,48 +63,48 @@ public class BitmapsChecksumTest {
   public static Collection<Object[]> data() {
     return Arrays.asList(new Object[][]{
         {
-            "/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Dimension(500, 500)), FilterType.Bessel,
+            "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Dimension(500, 500)), FilterType.Bessel,
             "101-6467-126-3534108-8927-58-26-37248672"
         },
         {
-            "/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Dimension(500, 800)), FilterType.Box,
+            "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Dimension(500, 800)), FilterType.Box,
             "-748135-126-6412111-11925-1038826-95-32-6-104"
         },
         {
-            "/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Dimension(4000, 5500)), FilterType.Box,
+            "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Dimension(4000, 5500)), FilterType.Box,
             "-646510160-466410970-77-1031184396-8-23-18"
         },
         {
-            "/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Dimension(600, 300)), FilterType.Bessel,
+            "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Dimension(600, 300)), FilterType.Bessel,
             "-69-11478-721003586-100-72-85-1559101-118-24-94"
         },
         {
-            "/images/042_1.jb2", 1, new PreconfiguredImageReadParam(2, 2, 0, 0), FilterType.Bessel,
+            "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(2, 2, 0, 0), FilterType.Bessel,
             "-4979-94-68-125645751-2111712617-59-295"
         },
         {
-            "/images/042_1.jb2", 1, new PreconfiguredImageReadParam(2, 2, 0, 0), FilterType.Lanczos,
+            "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(2, 2, 0, 0), FilterType.Lanczos,
             "-4979-94-68-125645751-2111712617-59-295"
         },
         {
-            "/images/042_1.jb2", 1, new PreconfiguredImageReadParam(3, 3, 1, 1), FilterType.Lanczos,
+            "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(3, 3, 1, 1), FilterType.Lanczos,
             "84-1069410599-9575-7934-1279-80-85127-18-128"
         },
         {
-            "/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Rectangle(100, 100, 500, 500)),
+            "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Rectangle(100, 100, 500, 500)),
             FilterType.Lanczos, "1245-23-127954634-1232173-109-5739-303-48"
         },
         {
-            "/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Rectangle(500, 500, 2000, 2000)),
+            "target/images/042_1.jb2", 1, new PreconfiguredImageReadParam(new Rectangle(500, 500, 2000, 2000)),
             FilterType.Lanczos, "-60-45-117-90-6596-11556-47-30-112-741138412082"
         },
         {
-            "/images/042_1.jb2", 1,
+            "target/images/042_1.jb2", 1,
             new PreconfiguredImageReadParam(new Rectangle(500, 500, 2000, 2000), new Dimension(678, 931)),
             FilterType.Lanczos, "-17-95-5543-12062-625054-94-88-31-4-120-1971"
         },
         {
-            "/images/042_1.jb2", 1,
+            "target/images/042_1.jb2", 1,
             new PreconfiguredImageReadParam(new Rectangle(500, 500, 2000, 2000), new Dimension(678, 931), 3, 3, 1, 1),
             FilterType.Lanczos, "-109-60118-41999255-94113-5019-2818-10-39-71"
         }
@@ -124,43 +122,44 @@ public class BitmapsChecksumTest {
 
   @Test
   public void test() throws IOException, JBIG2Exception, NoSuchAlgorithmException {
-    final InputStream inputStream = JBIG2ImageReaderDemo.class.getResourceAsStream(resourcePath);
-    // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
 
-    final InputStreamFactory disf = new DefaultInputStreamFactory();
-    final ImageInputStream iis = disf.getInputStream(inputStream);
-
-    final JBIG2DocumentFacade doc = new JBIG2DocumentFacade(iis);
-    final Bitmap b = doc.getPageBitmap(pageNumber);
-    final WritableRaster raster = Bitmaps.asRaster(b, param, filterType);
-
-    final DataBufferByte dataBufferByte = (DataBufferByte) raster.getDataBuffer();
-    final byte[] bytes = dataBufferByte.getData();
-
-    final MessageDigest md = MessageDigest.getInstance("MD5");
-
-    final byte[] digest = md.digest(bytes);
-    final StringBuilder sb = new StringBuilder();
-    for (byte toAppend : digest) {
-      sb.append(toAppend);
-    }
-
-    assertArrayEquals(checksum.getBytes(), sb.toString().getBytes());
+      final File inputFile = new File(resourcePath);
+      // skip test if input stream isn't available
+      assumeTrue(inputFile.exists());
 
+      final InputStream inputStream = new FileInputStream(inputFile);
+    
+      final InputStreamFactory disf = new DefaultInputStreamFactory();
+      final ImageInputStream iis = disf.getInputStream(inputStream);
+        
+      final JBIG2DocumentFacade doc = new JBIG2DocumentFacade(iis);
+      final Bitmap b = doc.getPageBitmap(pageNumber);
+      final WritableRaster raster = Bitmaps.asRaster(b, param, filterType);
+      
+      final DataBufferByte dataBufferByte = (DataBufferByte) raster.getDataBuffer();
+      final byte[] bytes = dataBufferByte.getData();
+      
+      final MessageDigest md = MessageDigest.getInstance("MD5");
+      
+      final byte[] digest = md.digest(bytes);
+      final StringBuilder sb = new StringBuilder();
+      for (byte toAppend : digest) {
+          sb.append(toAppend);
+      }
+        
+      assertArrayEquals(checksum.getBytes(), sb.toString().getBytes());
   }
 
   static class RasterChecksumCalculator {
     public static void main(String[] args) throws IOException, JBIG2Exception, NoSuchAlgorithmException {
-      final String resourcePath = "/images/042_1.jb2";
 
-      final int pageNumber = 1;
+      final File inputFile = new File("target/images/042_1.jb2");
+      // skip test if input stream isn't available
+      assumeTrue(inputFile.exists());
 
-      final URL imageUrl = JBIG2ImageReaderDemo.class.getResource(resourcePath);
+      final int pageNumber = 1;
 
-      final InputStream inputStream = new FileInputStream(new File(imageUrl.getPath()));
-      // skip test if input stream isn't available
-      assumeTrue(inputStream != null && inputStream.available() > 0);
+      final InputStream inputStream = new FileInputStream(inputFile);
 
       final InputStreamFactory disf = new DefaultInputStreamFactory();
       final ImageInputStream iis = disf.getInputStream(inputStream);

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/segments/GenericRegionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/segments/GenericRegionTest.java b/src/test/java/org/apache/pdfbox/jbig2/segments/GenericRegionTest.java
index 86251f1..ade800f 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/segments/GenericRegionTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/segments/GenericRegionTest.java
@@ -19,6 +19,8 @@ package org.apache.pdfbox.jbig2.segments;
 
 import static org.junit.Assume.assumeTrue;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -40,9 +42,11 @@ public class GenericRegionTest {
 
   @Test
   public void parseHeaderTest() throws IOException, InvalidHeaderValueException {
-    InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
+    final File inputFile = new File("target/images/sampledata.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    final InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);
@@ -81,9 +85,11 @@ public class GenericRegionTest {
   @Ignore
   @Test
   public void decodeTemplate0Test() throws Throwable {
-    InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
+    final File inputFile = new File("target/images/sampledata.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    final InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);
@@ -99,9 +105,11 @@ public class GenericRegionTest {
   @Test
   public void decodeWithArithmetichCoding() throws Throwable {
 
-    InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
+    final File inputFile = new File("target/images/sampledata.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    final InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);
@@ -116,9 +124,12 @@ public class GenericRegionTest {
   @Ignore
   @Test
   public void decodeWithMMR() throws Throwable {
-    InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
+
+    final File inputFile = new File("target/images/sampledata.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    final InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/segments/HalftoneRegionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/segments/HalftoneRegionTest.java b/src/test/java/org/apache/pdfbox/jbig2/segments/HalftoneRegionTest.java
index 71cbfcb..7559259 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/segments/HalftoneRegionTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/segments/HalftoneRegionTest.java
@@ -19,6 +19,8 @@ package org.apache.pdfbox.jbig2.segments;
 
 import static org.junit.Assume.assumeTrue;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -37,9 +39,12 @@ public class HalftoneRegionTest {
 
   @Test
   public void parseHeaderTest() throws IOException, InvalidHeaderValueException {
-    InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
+
+    final File inputFile = new File("target/images/sampledata.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    final InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/segments/PageInformationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/segments/PageInformationTest.java b/src/test/java/org/apache/pdfbox/jbig2/segments/PageInformationTest.java
index 35e43c3..700a6ad 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/segments/PageInformationTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/segments/PageInformationTest.java
@@ -19,6 +19,8 @@ package org.apache.pdfbox.jbig2.segments;
 
 import static org.junit.Assume.assumeTrue;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -37,9 +39,12 @@ public class PageInformationTest {
 	@Test
 	public void parseHeaderCompleteTest() throws IOException,
 			InvalidHeaderValueException {
-		InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
+
+	    final File inputFile = new File("target/images/sampledata.jb2");
 	    // skip test if input stream isn't available
-	    assumeTrue(inputStream != null && inputStream.available() > 0);
+	    assumeTrue(inputFile.exists());
+
+	    final InputStream inputStream = new FileInputStream(inputFile);
 
 	    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
 		ImageInputStream iis = disf.getInputStream(inputStream);

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/segments/PatternDictionaryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/segments/PatternDictionaryTest.java b/src/test/java/org/apache/pdfbox/jbig2/segments/PatternDictionaryTest.java
index 7329cf0..63b333c 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/segments/PatternDictionaryTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/segments/PatternDictionaryTest.java
@@ -19,6 +19,8 @@ package org.apache.pdfbox.jbig2.segments;
 
 import static org.junit.Assume.assumeTrue;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -36,9 +38,12 @@ import org.junit.Test;
 public class PatternDictionaryTest {
   @Test
   public void parseHeaderTest() throws IOException, InvalidHeaderValueException {
-    InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
+
+    final File inputFile = new File("target/images/sampledata.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    final InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);
@@ -59,11 +64,14 @@ public class PatternDictionaryTest {
   @Ignore
   @Test
   public void decodeTestWithOutput() throws Throwable {
-    InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
-    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
+
+    final File inputFile = new File("target/images/sampledata.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
 
+    final InputStream inputStream = new FileInputStream(inputFile);
+      
+    DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);
     // Sixth Segment (number 5)
     SubInputStream sis = new SubInputStream(iis, 245, 45);
@@ -83,9 +91,12 @@ public class PatternDictionaryTest {
   @Ignore
   @Test
   public void decodeTestWithOutput2() throws Throwable {
-    InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
+
+    final File inputFile = new File("target/images/sampledata.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
+
+    final InputStream inputStream = new FileInputStream(inputFile);
 
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/segments/RegionSegmentInformationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/segments/RegionSegmentInformationTest.java b/src/test/java/org/apache/pdfbox/jbig2/segments/RegionSegmentInformationTest.java
index cca5438..89f86ec 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/segments/RegionSegmentInformationTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/segments/RegionSegmentInformationTest.java
@@ -19,6 +19,8 @@ package org.apache.pdfbox.jbig2.segments;
 
 import static org.junit.Assume.assumeTrue;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -34,10 +36,12 @@ public class RegionSegmentInformationTest {
 
   @Test
   public void parseHeaderTest() throws IOException {
-    InputStream inputStream = getClass().getResourceAsStream("/images/sampledata.jb2");
+
+    final File inputFile = new File("target/images/sampledata.jb2");
     // skip test if input stream isn't available
-    assumeTrue(inputStream != null && inputStream.available() > 0);
+    assumeTrue(inputFile.exists());
 
+    InputStream inputStream = new FileInputStream(inputFile);
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
     ImageInputStream iis = disf.getInputStream(inputStream);
     SubInputStream sis = new SubInputStream(iis, 130, 49);

http://git-wip-us.apache.org/repos/asf/pdfbox-jbig2/blob/dbaef86d/src/test/java/org/apache/pdfbox/jbig2/segments/TextRegionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/pdfbox/jbig2/segments/TextRegionTest.java b/src/test/java/org/apache/pdfbox/jbig2/segments/TextRegionTest.java
index da6f961..3aefea4 100644
--- a/src/test/java/org/apache/pdfbox/jbig2/segments/TextRegionTest.java
+++ b/src/test/java/org/apache/pdfbox/jbig2/segments/TextRegionTest.java
@@ -17,7 +17,11 @@
 
 package org.apache.pdfbox.jbig2.segments;
 
+import static org.junit.Assume.assumeTrue;
+
 import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -40,12 +44,16 @@ public class TextRegionTest {
   @Ignore
   @Test
   public void textRegionWith() throws IOException, InvalidHeaderValueException, IntegerMaxValueException {
-    String filepath = "/images/042_11.jb2";
+
     int pageNumber = 1;
 
-    InputStream is = getClass().getResourceAsStream(filepath);
+    final File inputFile = new File("target/images/042_11.jb2");
+    // skip test if input stream isn't available
+    assumeTrue(inputFile.exists());
+
+    InputStream inputStream = new FileInputStream(inputFile);
     DefaultInputStreamFactory disf = new DefaultInputStreamFactory();
-    ImageInputStream iis = disf.getInputStream(is);
+    ImageInputStream iis = disf.getInputStream(inputStream);
     JBIG2ImageReader jb2 = new JBIG2ImageReader(new JBIG2ImageReaderSpi());
     jb2.setInput(iis);
     BufferedImage b = jb2.read(pageNumber);


Mime
View raw message