ForexSwapDiscountingMethod { public MultipleCurrencyAmount presentValue(final ForexSwap fx, final MulticurveProviderInterface multicurves) { ArgumentChecker.notNull(fx, "Forex swap"); ArgumentChecker.notNull(multicurves, "Multi-curves provider"); final MultipleCurrencyAmount pv = METHOD_FX.presentValue(fx.getNearLeg(), multicurves); return pv.plus(METHOD_FX.presentValue(fx.getFarLeg(), multicurves)); } private  ForexSwapDiscountingMethod(); static ForexSwapDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final ForexSwap fx, final MulticurveProviderInterface multicurves); MultipleCurrencyAmount currencyExposure(final ForexSwap fx, final MulticurveProviderInterface multicurves); double parSpread(final ForexSwap fx, final MulticurveProviderInterface multicurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final ForexSwap fx, final MulticurveProviderInterface multicurves); MulticurveSensitivity parSpreadCurveSensitivity(final ForexSwap fx, final MulticurveProviderInterface multicurves);  }
@Test public void presentValue() { final MultipleCurrencyAmount pv = METHOD_FX_SWAP.presentValue(FX_SWAP, MULTICURVES); final MultipleCurrencyAmount pvNear = METHOD_FX.presentValue((FX_SWAP).getNearLeg(), MULTICURVES); final MultipleCurrencyAmount pvFar = METHOD_FX.presentValue((FX_SWAP).getFarLeg(), MULTICURVES); assertEquals(pvNear.getAmount(CUR_1) + pvFar.getAmount(CUR_1), pv.getAmount(CUR_1)); assertEquals(pvNear.getAmount(CUR_2) + pvFar.getAmount(CUR_2), pv.getAmount(CUR_2)); }
@Test public void presentValueMethodVsCalculator() { final MultipleCurrencyAmount pvMethod = METHOD_FX_SWAP.presentValue(FX_SWAP, MULTICURVES); final MultipleCurrencyAmount pvCalculator = FX_SWAP.accept(PVDC, MULTICURVES); assertEquals("Forex present value: Method vs Calculator", pvMethod, pvCalculator); }