ForexDiscountingMethod { public double forwardForexRate(final Forex fx, final MulticurveProviderInterface multicurves) { final double dfDomestic = multicurves.getDiscountFactor(fx.getCurrency2(), fx.getPaymentTime()); final double dfForeign = multicurves.getDiscountFactor(fx.getCurrency1(), fx.getPaymentTime()); final double spot = multicurves.getFxRate(fx.getCurrency1(), fx.getCurrency2()); return spot * dfForeign / dfDomestic; } private  ForexDiscountingMethod(); static ForexDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final Forex fx, final MulticurveProviderInterface multicurves); MultipleCurrencyAmount currencyExposure(final Forex fx, final MulticurveProviderInterface multicurves); double parSpread(final Forex fx, final MulticurveProviderInterface multicurves); double forwardForexRate(final Forex fx, final MulticurveProviderInterface multicurves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final Forex fx, final MulticurveProviderInterface multicurves); MulticurveSensitivity parSpreadCurveSensitivity(final Forex fx, final MulticurveProviderInterface multicurves);  }
@Test public void forwardRate() { final double fwd = METHOD_FX.forwardForexRate(FX, MULTICURVES); final double dfDomestic = MULTICURVES.getDiscountFactor(FX.getCurrency1(), FX.getPaymentTime()); final double dfForeign = MULTICURVES.getDiscountFactor(FX.getCurrency2(), FX.getPaymentTime()); final double fwdExpected = MULTICURVES.getFxRate(FX.getCurrency1(), FX.getCurrency2()) * dfDomestic / dfForeign; assertEquals("Forex: forward rate", fwdExpected, fwd, TOLERANCE_RATE); }