@Test
public void testSerialization()
throws DerivativeException, IOException, ClassNotFoundException {
double[] y = { 0.0, 1.0, -2.0 };
DummyStepInterpolator interpolator = new DummyStepInterpolator(y, new double[y.length], true);
interpolator.storeTime(0);
interpolator.shift();
interpolator.storeTime(1);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(interpolator);
assertTrue(bos.size () > 150);
assertTrue(bos.size () < 250);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bis);
DummyStepInterpolator dsi = (DummyStepInterpolator) ois.readObject();
dsi.setInterpolatedTime(0.5);
double[] result = dsi.getInterpolatedState();
for (int i = 0; i < result.length; ++i) {
assertTrue(Math.abs(result[i] - y[i]) < 1.0e-10);
}
}