commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r590665 - /commons/proper/math/trunk/src/test/org/apache/commons/math/ode/DummyStepInterpolatorTest.java
Date Wed, 31 Oct 2007 13:34:00 GMT
Author: luc
Date: Wed Oct 31 06:33:59 2007
New Revision: 590665

URL: http://svn.apache.org/viewvc?rev=590665&view=rev
Log:
improved test coverage

Modified:
    commons/proper/math/trunk/src/test/org/apache/commons/math/ode/DummyStepInterpolatorTest.java

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/DummyStepInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/DummyStepInterpolatorTest.java?rev=590665&r1=590664&r2=590665&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/DummyStepInterpolatorTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/DummyStepInterpolatorTest.java
Wed Oct 31 06:33:59 2007
@@ -98,6 +98,35 @@
 
   }
 
+  public void testImpossibleSerialization()
+  throws DerivativeException, IntegratorException,
+         IOException, ClassNotFoundException {
+
+    double[] y = { 0.0, 1.0, -2.0 };
+    DummyStepInterpolator interpolator = new DummyStepInterpolator(y, true) {
+      protected void doFinalize()
+        throws DerivativeException {
+          throw new DerivativeException(null);
+      }
+    };
+    interpolator.storeTime(0);
+    interpolator.shift();
+    interpolator.storeTime(1);
+
+    ByteArrayOutputStream bos = new ByteArrayOutputStream();
+    ObjectOutputStream    oos = new ObjectOutputStream(bos);
+    try {
+        oos.writeObject(interpolator);
+        fail("an exception should have been thrown");
+    } catch (IOException ioe) {
+        // expected behavior
+        assertNull(ioe.getMessage());
+    } catch (Exception e) {
+        fail("wrong exception caught");
+    }
+
+  }
+
   public void testSerializationError()
   throws DerivativeException, IntegratorException,
          IOException, ClassNotFoundException {



Mime
View raw message