CouponInflationZeroCouponMonthlyDiscountingMethod { public MultipleCurrencyAmount presentValue(final CouponInflationZeroCouponMonthly coupon, final InflationProviderInterface inflation) { ArgumentChecker.notNull(coupon, "Coupon"); ArgumentChecker.notNull(inflation, "Inflation"); final double discountFactor = inflation.getDiscountFactor(coupon.getCurrency(), coupon.getPaymentTime()); return netAmount(coupon, inflation).multipliedBy(discountFactor); }  MultipleCurrencyAmount netAmount(final CouponInflationZeroCouponMonthly coupon, final InflationProviderInterface inflation); MultipleCurrencyAmount presentValue(final CouponInflationZeroCouponMonthly coupon, final InflationProviderInterface inflation); double indexEstimation(final CouponInflationZeroCouponMonthly coupon, final InflationProviderInterface inflation); MultipleCurrencyInflationSensitivity presentValueCurveSensitivity(final CouponInflationZeroCouponMonthly coupon, final InflationProviderInterface inflation);  }
@Test public void presentValueNoNotional() { final MultipleCurrencyAmount pv = METHOD.presentValue(ZERO_COUPON_NO, MARKET.getInflationProvider()); final double df = MARKET.getCurve(ZERO_COUPON_NO.getCurrency()).getDiscountFactor(ZERO_COUPON_NO.getPaymentTime()); final double finalIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(ZERO_COUPON_NO.getReferenceEndTime()); final double pvExpected = (finalIndex / INDEX_1MAY_2008 - 1) * df * NOTIONAL; assertEquals("Zero-coupon inflation DiscountingMethod: Present value", pvExpected, pv.getAmount(ZERO_COUPON_NO.getCurrency()), TOLERANCE_PV); }
@Test public void presentValueMethodVsCalculator() { final MultipleCurrencyAmount pvMethod = METHOD.presentValue(ZERO_COUPON_NO, MARKET.getInflationProvider()); final MultipleCurrencyAmount pvCalculator = ZERO_COUPON_NO.accept(PVIC, MARKET.getInflationProvider()); assertEquals("Zero-coupon inflation DiscountingMethod: Present value", pvMethod, pvCalculator); }
@Test public void presentValueWithNotional() { final MultipleCurrencyAmount pv = METHOD.presentValue(ZERO_COUPON_WITH, MARKET.getInflationProvider()); final double df = MARKET.getCurve(ZERO_COUPON_WITH.getCurrency()).getDiscountFactor(ZERO_COUPON_WITH.getPaymentTime()); final double finalIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(ZERO_COUPON_WITH.getReferenceEndTime()); final double pvExpected = (finalIndex / INDEX_1MAY_2008) * df * NOTIONAL; assertEquals("Zero-coupon inflation DiscountingMethod: Present value", pvExpected, pv.getAmount(ZERO_COUPON_WITH.getCurrency()), TOLERANCE_PV); }