You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2010/10/13 05:51:27 UTC

svn commit: r1021989 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java

Author: ggregory
Date: Wed Oct 13 03:51:27 2010
New Revision: 1021989

URL: http://svn.apache.org/viewvc?rev=1021989&view=rev
Log:
Improve code coverage.

Modified:
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java?rev=1021989&r1=1021988&r2=1021989&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/EndianUtilsTest.java Wed Oct 13 03:51:27 2010
@@ -18,6 +18,7 @@ package org.apache.commons.io;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
 import java.io.IOException;
 
 import junit.framework.TestCase;
@@ -31,6 +32,21 @@ public class EndianUtilsTest extends Tes
         super(name);
     }
 
+    public void testCtor() throws IOException {
+        new EndianUtils();
+        // Constructor does not blow up.
+    }
+
+    public void testEOFException() throws IOException {
+        ByteArrayInputStream input = new ByteArrayInputStream(new byte[] {});
+        try {
+            EndianUtils.readSwappedDouble(input);
+            fail("Expected EOFException");
+        } catch (EOFException e) {
+            // expected
+        }
+    }
+
     public void testSwapShort() {
         assertEquals( (short) 0, EndianUtils.swapShort( (short) 0 ) );
         assertEquals( (short) 0x0201, EndianUtils.swapShort( (short) 0x0102 ) );