mirror of
https://github.com/apache/commons-math.git
synced 2025-02-06 01:59:13 +00:00
improved test coverage
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@590665 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
eb38117be0
commit
49b22866c5
@ -98,6 +98,35 @@ public class DummyStepInterpolatorTest
|
||||
|
||||
}
|
||||
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user