BillTransactionDiscountingMethod { public MultipleCurrencyAmount presentValueFromYield(final BillTransaction bill, final double yield, final IssuerProviderInterface issuer) { ArgumentChecker.notNull(bill, "Bill"); ArgumentChecker.notNull(issuer, "Issuer and multi-curves provider"); final Currency ccy = bill.getCurrency(); final MultipleCurrencyAmount pvSecurity = METHOD_SECURITY.presentValueFromYield(bill.getBillStandard(), yield, issuer); final double pvSettle = bill.getSettlementAmount() * issuer.getMulticurveProvider().getDiscountFactor(ccy, bill.getBillPurchased().getSettlementTime()); return pvSecurity.plus(MultipleCurrencyAmount.of(bill.getCurrency(), pvSettle)); } private  BillTransactionDiscountingMethod(); static BillTransactionDiscountingMethod getInstance(); MultipleCurrencyAmount presentValue(final BillTransaction bill, final IssuerProviderInterface issuer); MultipleCurrencyAmount presentValueFromYield(final BillTransaction bill, final double yield, final IssuerProviderInterface issuer); MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity(final BillTransaction bill, final IssuerProviderInterface issuer); double parSpread(final BillTransaction bill, final IssuerProviderInterface issuer); MulticurveSensitivity parSpreadCurveSensitivity(final BillTransaction bill, final IssuerProviderInterface issuer);  }
@Test public void presentValueFromYield() { final MultipleCurrencyAmount pvTransactionComputed = METHOD_TRANSACTION.presentValueFromYield(BILL_TRA, YIELD, ISSUER_MULTICURVE); final MultipleCurrencyAmount pvSecurity = METHOD_SECURITY.presentValue(BILL_TRA.getBillStandard(), ISSUER_MULTICURVE); final double pvSettle = ISSUER_MULTICURVE.getMulticurveProvider().getDiscountFactor(BILL_TRA.getCurrency(), BILL_TRA.getBillPurchased().getSettlementTime()) * BILL_TRA.getSettlementAmount(); final MultipleCurrencyAmount pvTransactionExpected = pvSecurity.plus(MultipleCurrencyAmount.of(BILL_TRA.getCurrency(), pvSettle)); assertEquals("Bill Security: discounting method - present value from yield", pvTransactionExpected.getAmount(EUR), pvTransactionComputed.getAmount(EUR), TOLERANCE_PV_DELTA); }