commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1649134 - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/formats/icns/ test/java/org/apache/commons/imaging/formats/icns/
Date Fri, 02 Jan 2015 22:02:00 GMT
Author: britter
Date: Fri Jan  2 22:02:00 2015
New Revision: 1649134

URL: http://svn.apache.org/r1649134
Log:
Make IcnsReadTest a parameterized test

Modified:
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
    commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsBaseTest.java
    commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java?rev=1649134&r1=1649133&r2=1649134&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
Fri Jan  2 22:02:00 2015
@@ -71,6 +71,7 @@ public class IcnsImageParser extends Ima
         return new ImageFormat[] { ImageFormats.ICNS };
     }
 
+    // FIXME should throw UOE
     @Override
     public ImageMetadata getMetadata(final ByteSource byteSource, final Map<String, Object>
params)
             throws ImageReadException, IOException {

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsBaseTest.java?rev=1649134&r1=1649133&r2=1649134&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsBaseTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsBaseTest.java
Fri Jan  2 22:02:00 2015
@@ -41,7 +41,7 @@ public abstract class IcnsBaseTest exten
         }
     };
 
-    protected List<File> getIcnsImages() throws IOException, ImageReadException {
+    protected static List<File> getIcnsImages() throws IOException, ImageReadException
{
         return getTestImages(IMAGE_FILTER);
     }
 }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java?rev=1649134&r1=1649133&r2=1649134&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
(original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
Fri Jan  2 22:02:00 2015
@@ -21,6 +21,8 @@ import static org.junit.Assert.assertNot
 
 import java.awt.image.BufferedImage;
 import java.io.File;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,30 +32,41 @@ import org.apache.commons.imaging.Imagin
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
+@RunWith(Parameterized.class)
 public class IcnsReadTest extends IcnsBaseTest {
 
-    @Test
-    public void test() throws Exception {
-        Debug.debug("start");
-
-        final List<File> images = getIcnsImages();
-        for (int i = 0; i < images.size(); i++) {
+    private File imageFile;
 
-            final File imageFile = images.get(i);
-            Debug.debug("imageFile", imageFile);
+    @Parameterized.Parameters
+    public static Collection<File> data() throws Exception {
+        return getIcnsImages();
+    }
 
-            final ImageMetadata metadata = Imaging.getMetadata(imageFile);
-            Assert.assertFalse(metadata instanceof File); // Dummy check to avoid unused
warning (it may be null)
+    public IcnsReadTest(File imageFile) {
+        this.imageFile = imageFile;
+    }
 
-            final Map<String, Object> params = new HashMap<String, Object>();
-            final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
-            assertNotNull(imageInfo);
+    @Ignore(value = "RoundtripTest has to be fixed befor implementation can throw UnsupportedOperationException")
+    @Test(expected = UnsupportedOperationException.class)
+    public void testImageMetadata() throws Exception {
+        final ImageMetadata metadata = Imaging.getMetadata(imageFile);
+    }
 
-            final BufferedImage image = Imaging.getBufferedImage(imageFile);
-            assertNotNull(image);
-        }
+    @Test
+    public void testImageInfo() throws Exception {
+        final ImageInfo imageInfo = Imaging.getImageInfo(imageFile, Collections.<String,
Object> emptyMap());
+        assertNotNull(imageInfo);
     }
 
+    @Test
+    public void testBufferedImage() throws Exception {
+        final BufferedImage image = Imaging.getBufferedImage(imageFile);
+        assertNotNull(image);
+        // TODO assert more
+    }
 }



Mime
View raw message