CapFloorCMSSpread extends CouponFloating implements CapFloor { @SuppressWarnings("deprecation") @Override public CapFloorCMSSpread withNotional(final double notional) { try { return new CapFloorCMSSpread(getCurrency(), getPaymentTime(), getPaymentYearFraction(), notional, getFixingTime(), _underlyingSwap1, _cmsIndex1, _underlyingSwap2, _cmsIndex2, _settlementTime, _strike, _isCap, getFundingCurveName()); } catch (final IllegalStateException e) { return new CapFloorCMSSpread(getCurrency(), getPaymentTime(), getPaymentYearFraction(), notional, getFixingTime(), _underlyingSwap1, _cmsIndex1, _underlyingSwap2, _cmsIndex2, _settlementTime, _strike, _isCap); } } @Deprecated  CapFloorCMSSpread(final Currency currency, final double paymentTime, final double paymentYearFraction, final double notional, final double fixingTime,
      final SwapFixedCoupon<? extends Payment> underlyingSwap1, final IndexSwap cmsIndex1, final SwapFixedCoupon<? extends Payment> underlyingSwap2, final IndexSwap cmsIndex2,
      final double settlementTime, final double strike, final boolean isCap, final String fundingCurveName);  CapFloorCMSSpread(final Currency currency, final double paymentTime, final double paymentYearFraction, final double notional, final double fixingTime,
      final SwapFixedCoupon<? extends Payment> underlyingSwap1, final IndexSwap cmsIndex1, final SwapFixedCoupon<? extends Payment> underlyingSwap2, final IndexSwap cmsIndex2,
      final double settlementTime, final double strike, final boolean isCap); @SuppressWarnings("deprecation") static CapFloorCMSSpread from(final CouponFloating coupon, final SwapFixedCoupon<Coupon> underlyingSwap1, final IndexSwap cmsIndex1, final SwapFixedCoupon<Coupon> underlyingSwap2,
      final IndexSwap cmsIndex2, final double settlementTime, final double strike, final boolean isCap); SwapFixedCoupon<? extends Payment> getUnderlyingSwap1(); IndexSwap getCmsIndex1(); SwapFixedCoupon<? extends Payment> getUnderlyingSwap2(); IndexSwap getCmsIndex2(); double getSettlementTime(); @Override double getStrike(); @Override boolean isCap(); @Override /** * The "fixing" is the difference between the first and the second CMS rates. */ double payOff(final double fixing); @SuppressWarnings("deprecation") @Override CapFloorCMSSpread 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 CapFloorCMSSpread cmsSpread = new CapFloorCMSSpread(CUR, PAYMENT_TIME, PAYMENT_ACCRUAL_FACTOR, notional, FIXING_TIME, SWAP_1, CMS_INDEX_1, SWAP_2, CMS_INDEX_2, SETTLEMENT_TIME, STRIKE, IS_CAP); assertEquals(cmsSpread, CMS_SPREAD.withNotional(notional)); }