### Question:
DiscountingFixedCouponBondPaymentPeriodPricer { public PointSensitivityBuilder presentValueSensitivityWithSpread( FixedCouponBondPaymentPeriod period, IssuerCurveDiscountFactors discountFactors, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear) { if (period.getPaymentDate().isBefore(discountFactors.getValuationDate())) { return PointSensitivityBuilder.none(); } ZeroRateSensitivity zeroSensi = discountFactors.getDiscountFactors().zeroRatePointSensitivityWithSpread( period.getPaymentDate(), zSpread, compoundedRateType, periodsPerYear); IssuerCurveZeroRateSensitivity dscSensi = IssuerCurveZeroRateSensitivity.of(zeroSensi, discountFactors.getLegalEntityGroup()); 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_presentValueSensitivityWithSpread() { PointSensitivityBuilder computed = PRICER.presentValueSensitivityWithSpread( PAYMENT_PERIOD, ISSUER_CURVE, Z_SPREAD, PERIODIC, PERIOD_PER_YEAR); PointSensitivityBuilder expected = IssuerCurveZeroRateSensitivity.of( DSC_FACTORS.zeroRatePointSensitivityWithSpread(END_ADJUSTED, Z_SPREAD, PERIODIC, PERIOD_PER_YEAR) .multipliedBy(FIXED_RATE * NOTIONAL * YEAR_FRACTION), GROUP); assertThat(computed).isEqualTo(expected); }
@Test public void test_presentValueSensitivityWithSpread_past() { PointSensitivityBuilder computed = PRICER.presentValueSensitivityWithSpread( PAYMENT_PERIOD, ISSUER_CURVE_AFTER, Z_SPREAD, PERIODIC, PERIOD_PER_YEAR); assertThat(computed).isEqualTo(PointSensitivityBuilder.none()); }