### Question:
DiscountingFixedCouponBondPaymentPeriodPricer { public double presentValue(FixedCouponBondPaymentPeriod period, IssuerCurveDiscountFactors discountFactors) { if (period.getPaymentDate().isBefore(discountFactors.getValuationDate())) { return 0d; } double df = discountFactors.discountFactor(period.getPaymentDate()); return period.getFixedRate() * period.getNotional() * period.getYearFraction() * df; } DiscountingFixedCouponBondPaymentPeriodPricer(); double presentValue(FixedCouponBondPaymentPeriod period, IssuerCurveDiscountFactors discountFactors); double presentValueWithSpread(
      FixedCouponBondPaymentPeriod period,
      IssuerCurveDiscountFactors discountFactors,
      double zSpread,
      CompoundedRateType compoundedRateType,
      int periodsPerYear); double forecastValue(FixedCouponBondPaymentPeriod period, IssuerCurveDiscountFactors discountFactors); PointSensitivityBuilder presentValueSensitivity(
      FixedCouponBondPaymentPeriod period,
      IssuerCurveDiscountFactors discountFactors); PointSensitivityBuilder presentValueSensitivityWithSpread(
      FixedCouponBondPaymentPeriod period,
      IssuerCurveDiscountFactors discountFactors,
      double zSpread,
      CompoundedRateType compoundedRateType,
      int periodsPerYear); PointSensitivityBuilder forecastValueSensitivity(
      FixedCouponBondPaymentPeriod period,
      IssuerCurveDiscountFactors discountFactors); void explainPresentValue(
      FixedCouponBondPaymentPeriod period,
      IssuerCurveDiscountFactors discountFactors,
      ExplainMapBuilder builder); void explainPresentValueWithSpread(
      FixedCouponBondPaymentPeriod period,
      IssuerCurveDiscountFactors discountFactors,
      ExplainMapBuilder builder,
      double zSpread,
      CompoundedRateType compoundedRateType,
      int periodsPerYear); static final DiscountingFixedCouponBondPaymentPeriodPricer DEFAULT; }### Answer:
@Test public void test_presentValue() { double computed = PRICER.presentValue(PAYMENT_PERIOD, ISSUER_CURVE); double expected = FIXED_RATE * NOTIONAL * YEAR_FRACTION * DSC_FACTORS.discountFactor(END_ADJUSTED); assertThat(computed).isEqualTo(expected); }
@Test public void test_presentValue_past() { double computed = PRICER.presentValue(PAYMENT_PERIOD, ISSUER_CURVE_AFTER); assertThat(computed).isEqualTo(0d); }