@Test
/**
* Test the present value using the method with the direct formula with extrapolation.
*/
public void presentValueAboveCutOff() {
CurrencyAmount methodPrice = METHOD.presentValue(CAP_HIGH_LONG, SABR_BUNDLE);
final double df = CURVES.getCurve(FUNDING_CURVE_NAME).getDiscountFactor(CAP_HIGH_LONG.getPaymentTime());
final double forward = CAP_HIGH_LONG.accept(PRC, CURVES);
final double maturity = CAP_HIGH_LONG.getFixingPeriodEndTime() - CAP_LONG.getFixingPeriodStartTime();
final DoublesPair expiryMaturity = new DoublesPair(CAP_HIGH_LONG.getFixingTime(), maturity);
final double alpha = SABR_PARAMETERS.getAlpha(expiryMaturity);
final double beta = SABR_PARAMETERS.getBeta(expiryMaturity);
final double rho = SABR_PARAMETERS.getRho(expiryMaturity);
final double nu = SABR_PARAMETERS.getNu(expiryMaturity);
final SABRFormulaData sabrParam = new SABRFormulaData(alpha, beta, rho, nu);
final SABRExtrapolationRightFunction sabrExtrapolation = new SABRExtrapolationRightFunction(forward, sabrParam, CUT_OFF_STRIKE, CAP_HIGH_LONG.getFixingTime(), MU);
final EuropeanVanillaOption option = new EuropeanVanillaOption(CAP_HIGH_LONG.getStrike(), CAP_HIGH_LONG.getFixingTime(), CAP_HIGH_LONG.isCap());
final double expectedPrice = sabrExtrapolation.price(option) * CAP_HIGH_LONG.getNotional() * CAP_HIGH_LONG.getPaymentYearFraction() * df;
assertEquals("Cap/floor: SABR with extrapolation pricing", expectedPrice, methodPrice.getAmount(), 1E-2);
methodPrice = METHOD.presentValue(CAP_HIGH_LONG, SABR_BUNDLE);
assertEquals("Cap/floor: SABR with extrapolation pricing", expectedPrice, methodPrice.getAmount(), 1E-2);
}