### Question:
DiscountingFixedCouponBondPaymentPeriodPricer { public PointSensitivityBuilder presentValueSensitivity( FixedCouponBondPaymentPeriod period, IssuerCurveDiscountFactors discountFactors) { if (period.getPaymentDate().isBefore(discountFactors.getValuationDate())) { return PointSensitivityBuilder.none(); } IssuerCurveZeroRateSensitivity dscSensi = discountFactors.zeroRatePointSensitivity(period.getPaymentDate()); return dscSensi.multipliedBy(period.getFixedRate() * period.getNotional() * period.getYearFraction()); } 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_presentValueSensitivity() { PointSensitivityBuilder computed = PRICER.presentValueSensitivity(PAYMENT_PERIOD, ISSUER_CURVE); PointSensitivityBuilder expected = IssuerCurveZeroRateSensitivity.of( DSC_FACTORS.zeroRatePointSensitivity(END_ADJUSTED).multipliedBy(FIXED_RATE * NOTIONAL * YEAR_FRACTION), GROUP); assertThat(computed).isEqualTo(expected); }
@Test public void test_presentValueSensitivity_past() { PointSensitivityBuilder computed = PRICER.presentValueSensitivity(PAYMENT_PERIOD, ISSUER_CURVE_AFTER); assertThat(computed).isEqualTo(PointSensitivityBuilder.none()); }