CapFloorCMS extends CouponFloating implements CapFloor { @Override @SuppressWarnings("deprecation") public Coupon withNotional(final double notional) { try { return new CapFloorCMS(getCurrency(), getPaymentTime(), getFundingCurveName(), getPaymentYearFraction(), notional, getFixingTime(), _underlyingSwap, _settlementTime, _strike, _isCap); } catch (final IllegalStateException e) { return new CapFloorCMS(getCurrency(), getPaymentTime(), getPaymentYearFraction(), notional, getFixingTime(), _underlyingSwap, _settlementTime, _strike, _isCap); } } @Deprecated  CapFloorCMS(final Currency currency, final double paymentTime, final String fundingCurveName, final double paymentYearFraction, final double notional,
      final double fixingTime, final SwapFixedCoupon<? extends Payment> underlyingSwap, final double settlementTime,
      final double strike, final boolean isCap);  CapFloorCMS(final Currency currency, final double paymentTime, final double paymentYearFraction, final double notional,
      final double fixingTime, final SwapFixedCoupon<? extends Payment> underlyingSwap, final double settlementTime,
      final double strike, final boolean isCap); @SuppressWarnings("deprecation") static CapFloorCMS from(final CouponCMS coupon, final double strike, final boolean isCap); SwapFixedCoupon<? extends Payment> getUnderlyingSwap(); double getSettlementTime(); @Override double getStrike(); @Override boolean isCap(); @Override double payOff(final double fixing); @Override @SuppressWarnings("deprecation") Coupon withNotional(final double notional); @Override int hashCode(); @Override boolean equals(final Object obj); @Override T accept(final InstrumentDerivativeVisitor<S, T> visitor, final S data); @Override T accept(final InstrumentDerivativeVisitor<?, T> visitor);  }
@Test public void testWithNotional() { final double notional = NOTIONAL + 1000; final CapFloorCMS capFloorCMS = new CapFloorCMS(CUR, ACCRUAL_FACTOR, RATE, NOTIONAL, ACCRUAL_FACTOR, CMS_CAP.getUnderlyingSwap(), SETTLEMENT_DAYS, STRIKE, IS_CAP); final CapFloorCMS expected = new CapFloorCMS(CUR, ACCRUAL_FACTOR, RATE, notional, ACCRUAL_FACTOR, CMS_CAP.getUnderlyingSwap(), SETTLEMENT_DAYS, STRIKE, IS_CAP); assertEquals(expected, capFloorCMS.withNotional(notional)); }