private boolean checkAppendError(ContinuousOutputModel cm, double t0, double[] y0, double t1)
     throws DerivativeException {
   try {
     ContinuousOutputModel otherCm = new ContinuousOutputModel();
     otherCm.handleStep(buildInterpolator(t0, y0, t1), true);
     cm.append(otherCm);
   } catch (IllegalArgumentException iae) {
     // expected behavior
     return true;
   }
   return false;
 }
  public void testErrorConditions() throws DerivativeException {

    ContinuousOutputModel cm = new ContinuousOutputModel();
    cm.handleStep(buildInterpolator(0, new double[] {0.0, 1.0, -2.0}, 1), true);

    // dimension mismatch
    assertTrue(checkAppendError(cm, 1.0, new double[] {0.0, 1.0}, 2.0));

    // hole between time ranges
    assertTrue(checkAppendError(cm, 10.0, new double[] {0.0, 1.0, -2.0}, 20.0));

    // propagation direction mismatch
    assertTrue(checkAppendError(cm, 1.0, new double[] {0.0, 1.0, -2.0}, 0.0));

    // no errors
    assertFalse(checkAppendError(cm, 1.0, new double[] {0.0, 1.0, -2.0}, 2.0));
  }