CouponInflationZeroCouponMonthlyGearingDiscountingMethod { public MultipleCurrencyAmount netAmount(final CouponInflationZeroCouponMonthlyGearing coupon, final InflationProviderInterface inflation) { ArgumentChecker.notNull(coupon, "Coupon"); ArgumentChecker.notNull(inflation, "Inflation"); final double estimatedIndex = indexEstimation(coupon, inflation); final double netAmount = coupon.getFactor() * (estimatedIndex / coupon.getIndexStartValue() - (coupon.payNotional() ? 0.0 : 1.0)) * coupon.getNotional(); return MultipleCurrencyAmount.of(coupon.getCurrency(), netAmount); }  MultipleCurrencyAmount netAmount(final CouponInflationZeroCouponMonthlyGearing coupon, final InflationProviderInterface inflation); MultipleCurrencyAmount presentValue(final CouponInflationZeroCouponMonthlyGearing coupon, final InflationProviderInterface inflation); double indexEstimation(final CouponInflationZeroCouponMonthlyGearing coupon, final InflationProviderInterface inflation); MultipleCurrencyInflationSensitivity presentValueCurveSensitivity(final CouponInflationZeroCouponMonthlyGearing coupon, final InflationProviderInterface inflation);  }
@Test public void netAmountNoNotional() { final MultipleCurrencyAmount pv = METHOD.netAmount(ZERO_COUPON_NO, MARKET.getInflationProvider()); final double finalIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(ZERO_COUPON_NO.getReferenceEndTime()); final double pvExpected = FACTOR * (finalIndex / INDEX_1MAY_2008 - 1) * NOTIONAL; assertEquals("Zero-coupon inflation: net amount", pvExpected, pv.getAmount(ZERO_COUPON_NO.getCurrency()), TOLERANCE_PV); }
@Test public void netAmountMethodVsCalculator() { final MultipleCurrencyAmount naMethod = METHOD.netAmount(ZERO_COUPON_NO, MARKET.getInflationProvider()); final MultipleCurrencyAmount naCalculator = ZERO_COUPON_NO.accept(NAIC, MARKET.getInflationProvider()); assertEquals("Zero-coupon inflation: Net amount", naMethod, naCalculator); }
@Test public void netAmountWithNotional() { final MultipleCurrencyAmount pv = METHOD.netAmount(ZERO_COUPON_WITH, MARKET.getInflationProvider()); final double finalIndex = MARKET.getCurve(PRICE_INDEX_EUR).getPriceIndex(ZERO_COUPON_WITH.getReferenceEndTime()); final double pvExpected = FACTOR * (finalIndex / INDEX_1MAY_2008) * NOTIONAL; assertEquals("Zero-coupon inflation: net amount", pvExpected, pv.getAmount(ZERO_COUPON_WITH.getCurrency()), TOLERANCE_PV); }