CapFloorCMS extends CouponFloating implements CapFloor { @SuppressWarnings("deprecation") public static CapFloorCMS from(final CouponCMS coupon, final double strike, final boolean isCap) { try { return new CapFloorCMS(coupon.getCurrency(), coupon.getPaymentTime(), coupon.getUnderlyingSwap().getFixedLeg().getNthPayment(0).getFundingCurveName(), coupon.getPaymentYearFraction(), coupon.getNotional(), coupon.getFixingTime(), coupon.getUnderlyingSwap(), coupon.getSettlementTime(), strike, isCap); } catch (final IllegalStateException e) { return new CapFloorCMS(coupon.getCurrency(), coupon.getPaymentTime(), coupon.getPaymentYearFraction(), coupon.getNotional(), coupon.getFixingTime(), coupon.getUnderlyingSwap(), coupon.getSettlementTime(), 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(expectedExceptions = IllegalArgumentException.class) public void testCMSCoupon() { CapFloorCMSDefinition.from(null, STRIKE, IS_CAP); }
@Test public void testFrom() { final CapFloorCMSDefinition capConstructor = new CapFloorCMSDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL, FIXING_DATE, SWAP_DEFINITION, CMS_INDEX, STRIKE, IS_CAP); final CapFloorCMSDefinition capFrom = CapFloorCMSDefinition.from(CMS_COUPON_DEFINITION, STRIKE, IS_CAP); assertEquals(capConstructor, capFrom); }