Author: britter
Date: Sun Dec 28 22:45:18 2014
New Revision: 1648265

URL: http://svn.apache.org/r1648265
Log:
Make DcxReadTest parameterized

Modified:
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
    
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxBaseTest.java
    
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java?rev=1648265&r1=1648264&r2=1648265&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
 Sun Dec 28 22:45:18 2014
@@ -77,24 +77,28 @@ public class DcxImageParser extends Imag
         };
     }
 
+    // FIXME should throw UOE
     @Override
     public IImageMetadata getMetadata(final ByteSource byteSource, final 
Map<String, Object> params)
             throws ImageReadException, IOException {
         return null;
     }
 
+    // FIXME should throw UOE
     @Override
     public ImageInfo getImageInfo(final ByteSource byteSource, final 
Map<String, Object> params)
             throws ImageReadException, IOException {
         return null;
     }
 
+    // FIXME should throw UOE
     @Override
     public Dimension getImageSize(final ByteSource byteSource, final 
Map<String, Object> params)
             throws ImageReadException, IOException {
         return null;
     }
 
+    // FIXME should throw UOE
     @Override
     public byte[] getICCProfileBytes(final ByteSource byteSource, final 
Map<String, Object> params)
             throws ImageReadException, IOException {

Modified: 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxBaseTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxBaseTest.java?rev=1648265&r1=1648264&r2=1648265&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxBaseTest.java
 (original)
+++ 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxBaseTest.java
 Sun Dec 28 22:45:18 2014
@@ -41,7 +41,7 @@ public abstract class DcxBaseTest extend
         }
     };
 
-    protected List<File> getDcxImages() throws IOException, ImageReadException 
{
+    protected static List<File> getDcxImages() throws IOException, 
ImageReadException {
         return getTestImages(IMAGE_FILTER);
     }
 }

Modified: 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java?rev=1648265&r1=1648264&r2=1648265&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
 (original)
+++ 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/dcx/DcxReadTest.java
 Sun Dec 28 22:45:18 2014
@@ -21,38 +21,49 @@ import static org.junit.Assert.assertNot
 
 import java.awt.image.BufferedImage;
 import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.Collection;
+import java.util.Collections;
 
 import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.Imaging;
 import org.apache.commons.imaging.common.IImageMetadata;
-import org.apache.commons.imaging.util.Debug;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
+@RunWith(Parameterized.class)
 public class DcxReadTest extends DcxBaseTest {
 
-    @Test
-    public void test() throws Exception {
-        Debug.debug("start");
+    private File imageFile;
 
-        final List<File> images = getDcxImages();
-        for (int i = 0; i < images.size(); i++) {
+    @Parameterized.Parameters
+    public static Collection<File> data() throws Exception {
+        return getDcxImages();
+    }
 
-            final File imageFile = images.get(i);
-            Debug.debug("imageFile", imageFile);
+    public DcxReadTest(File imageFile) {
+        this.imageFile = imageFile;
+    }
 
-            final IImageMetadata metadata = Imaging.getMetadata(imageFile);
-            // assertNotNull(metadata);
+    // TODO this should throw USO, but Roundtrip test has to be refactored 
completely before this can be changed
+    @Test//(expected = UnsupportedOperationException.class)
+    public void testImageMetadata() throws Exception {
+        final IImageMetadata metadata = Imaging.getMetadata(imageFile);
+        // assertNotNull(metadata);
+    }
 
-            final Map<String, Object> params = new HashMap<String, Object>();
-            final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, 
params);
-            // assertNotNull(imageInfo);
+    // TODO this should throw USO, but Roundtrip test has to be refactored 
completely before this can be changed
+    @Test//(expected = UnsupportedOperationException.class)
+    public void testImageInfo() throws Exception {
+        final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, 
Collections.<String, Object> emptyMap());
+        // assertNotNull(imageInfo);
+    }
 
-            final BufferedImage image = Imaging.getBufferedImage(imageFile);
-            assertNotNull(image);
-        }
+    @Test
+    public void testBufferedImage() throws Exception {
+        final BufferedImage image = Imaging.getBufferedImage(imageFile);
+        assertNotNull(image);
+        // TODO assert more
     }
 
 }


Reply via email to