CouponFixed extends Coupon { @SuppressWarnings("deprecation") public CouponFixed withRate(final double rate) { try { return new CouponFixed(getCurrency(), getPaymentTime(), getFundingCurveName(), getPaymentYearFraction(), getNotional(), rate, getAccrualStartDate(), getAccrualEndDate()); } catch (final IllegalStateException e) { return new CouponFixed(getCurrency(), getPaymentTime(), getPaymentYearFraction(), getNotional(), rate, getAccrualStartDate(), getAccrualEndDate()); } } @Deprecated  CouponFixed(final Currency currency, final double paymentTime, final String fundingCurveName, final double paymentYearFraction, final double notional, final double rate); @Deprecated  CouponFixed(final Currency currency, final double paymentTime, final String fundingCurveName, final double paymentYearFraction, final double notional, final double rate,
      final ZonedDateTime accrualStartDate, final ZonedDateTime accrualEndDate); @Deprecated  CouponFixed(final Currency currency, final double paymentTime, final String fundingCurveName, final double paymentYearFraction, final double rate);  CouponFixed(final Currency currency, final double paymentTime, final double paymentYearFraction, final double notional, final double rate);  CouponFixed(final Currency currency, final double paymentTime, final double paymentYearFraction, final double notional, final double rate,
      final ZonedDateTime accrualStartDate, final ZonedDateTime accrualEndDate);  CouponFixed(final Currency currency, final double paymentTime, final double paymentYearFraction, final double rate); double getFixedRate(); ZonedDateTime getAccrualStartDate(); ZonedDateTime getAccrualEndDate(); double getAmount(); @SuppressWarnings("deprecation") CouponFixed withUnitCoupon(); @SuppressWarnings("deprecation") CouponFixed withRate(final double rate); @SuppressWarnings("deprecation") CouponFixed withRateShifted(final double spread); @SuppressWarnings("deprecation") @Override CouponFixed withNotional(final double notional); @SuppressWarnings("deprecation") PaymentFixed toPaymentFixed(); @Override T accept(final InstrumentDerivativeVisitor<S, T> visitor, final S data); @Override T accept(final InstrumentDerivativeVisitor<?, T> visitor); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testWithRate() { final double notional = 10000; final double rate = COUPON + 1; final CouponFixed coupon = new CouponFixed(CUR, PAYMENT_TIME, YEAR_FRACTION, notional, COUPON); final CouponFixed expected = new CouponFixed(CUR, PAYMENT_TIME, YEAR_FRACTION, notional, rate); assertEquals(expected, coupon.withRate(rate)); }