CashDiscountingMethod { public double parRate(final Cash deposit, final MulticurveProviderInterface curves) { final double af = deposit.getAccrualFactor(); return (curves.getDiscountFactor(deposit.getCurrency(), deposit.getStartTime()) / curves.getDiscountFactor(deposit.getCurrency(), deposit.getEndTime()) - 1) / af; } private  CashDiscountingMethod(); static CashDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final Cash deposit, final MulticurveProviderInterface curves); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final Cash deposit, final MulticurveProviderInterface curves); double parRate(final Cash deposit, final MulticurveProviderInterface curves); double parSpread(final Cash deposit, final MulticurveProviderInterface curves); MulticurveSensitivity parSpreadCurveSensitivity(final Cash deposit, final MulticurveProviderInterface curves);  }
@Test public void parRateMethodVsCalculator() { final ZonedDateTime referenceDate = TRADE_DATE; final Cash deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate); final double parRateMethod = METHOD_DEPOSIT.parRate(deposit, PROVIDER); final double parRateCalculator = deposit.accept(PRDC, PROVIDER); assertEquals("DepositDefinition: par rate", parRateMethod, parRateCalculator, TOLERANCE_RATE); }