StandardSmileSurfaceDataBundle extends SmileSurfaceDataBundle { @Override public SmileSurfaceDataBundle withBumpedPoint(final int expiryIndex, final int strikeIndex, final double amount) { ArgumentChecker.isTrue(ArgumentChecker.isInRangeExcludingHigh(0, _nExpiries, expiryIndex), "Invalid index for expiry; {}", expiryIndex); final double[][] strikes = getStrikes(); ArgumentChecker.isTrue(ArgumentChecker.isInRangeExcludingHigh(0, strikes[expiryIndex].length, strikeIndex), "Invalid index for strike; {}", strikeIndex); final double[][] vols = new double[_nExpiries][]; for (int i = 0; i < _nExpiries; i++) { final int nStrikes = strikes[i].length; vols[i] = new double[nStrikes]; System.arraycopy(_impliedVols[i], 0, vols[i], 0, nStrikes); } vols[expiryIndex][strikeIndex] += amount; return new StandardSmileSurfaceDataBundle(getForwardCurve(), getExpiries(), getStrikes(), vols); } StandardSmileSurfaceDataBundle(final double spot, final double[] forwards, final double[] expiries, final double[][] strikes, final double[][] impliedVols,
      final Interpolator1D forwardCurveInterpolator);  StandardSmileSurfaceDataBundle(final ForwardCurve forwardCurve, final double[] expiries, final double[][] strikes, final double[][] impliedVols); @Override int getNumExpiries(); @Override double[] getExpiries(); @Override double[][] getStrikes(); @Override double[][] getVolatilities(); @Override double[] getForwards(); @Override ForwardCurve getForwardCurve(); @Override SmileSurfaceDataBundle withBumpedPoint(final int expiryIndex, final int strikeIndex, final double amount); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testLowExpiryIndexForBump() { DATA.withBumpedPoint(-1, 1, 0.01); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testHighExpiryIndexForBump() { DATA.withBumpedPoint(100, 1, 0.01); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testLowStrikeIndexForBump() { DATA.withBumpedPoint(1, -1, 0.01); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testHighStrikeIndexForBump() { DATA.withBumpedPoint(1, 100, 0.01); }
@Test public void testBumpedPoint() { final SmileSurfaceDataBundle bumped = DATA.withBumpedPoint(2, 3, 0.05); final double[][] bumpedVols = new double[VOLS.length][]; for (int i = 0; i < VOLS.length; i++) { bumpedVols[i] = VOLS[i]; } bumpedVols[2][3] += 0.05; assertEquals(bumped, new StandardSmileSurfaceDataBundle(FORWARD_CURVE, EXPIRIES, STRIKES, bumpedVols)); }