CouponFixedAccruedCompoundingDiscountingMethod { public MultipleCurrencyAmount presentValue(final CouponFixedAccruedCompounding coupon, final MulticurveProviderInterface multicurves) { Validate.notNull(coupon, "Coupon"); Validate.notNull(multicurves, "multicurve"); final double df = multicurves.getDiscountFactor(coupon.getCurrency(), coupon.getPaymentTime()); final double value = coupon.getAmount() * df; return MultipleCurrencyAmount.of(coupon.getCurrency(), value); } private  CouponFixedAccruedCompoundingDiscountingMethod(); static CouponFixedAccruedCompoundingDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final CouponFixedAccruedCompounding coupon, final MulticurveProviderInterface multicurves); CurrencyAmount presentValuePositiveNotional(final CouponFixedAccruedCompounding coupon, final MulticurveProviderInterface multicurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final CouponFixedAccruedCompounding cpn, final MulticurveProviderInterface multicurve);  }
@Test public void presentValue() { final MultipleCurrencyAmount pvRecComputed = METHOD.presentValue(CPN_REC, MULTICURVES); final double pvExpected = CPN_REC.getAmount() * MULTICURVES.getDiscountFactor(CPN_REC.getCurrency(), CPN_REC.getPaymentTime()); assertEquals("CouponFixedAccruedCompounding: Present value by discounting", pvExpected, pvRecComputed.getAmount(CPN_REC.getCurrency()), TOLERANCE_PV); final double pvPayExpected = CPN_PAY.getAmount() * MULTICURVES.getDiscountFactor(CPN_PAY.getCurrency(), CPN_PAY.getPaymentTime()); assertEquals("CouponFixedAccruedCompounding: Present value by discounting", pvPayExpected, -pvRecComputed.getAmount(CPN_REC.getCurrency()), TOLERANCE_PV); final CurrencyAmount pvPosPayComputed = METHOD.presentValuePositiveNotional(CPN_REC, MULTICURVES); assertEquals("CouponFixedAccruedCompounding: Present value by discounting", pvRecComputed.getAmount(CPN_REC.getCurrency()), pvPosPayComputed.getAmount(), TOLERANCE_PV); }