CapFloorIbor extends CouponFloating implements CapFloor { @SuppressWarnings("deprecation") public CapFloorIbor withStrike(final double strike) { try { return new CapFloorIbor(getCurrency(), getPaymentTime(), getFundingCurveName(), getPaymentYearFraction(), getNotional(), getFixingTime(), getIndex(), getFixingPeriodStartTime(), getFixingPeriodEndTime(), getFixingAccrualFactor(), getForwardCurveName(), strike, _isCap); } catch (final IllegalStateException e) { return new CapFloorIbor(getCurrency(), getPaymentTime(), getPaymentYearFraction(), getNotional(), getFixingTime(), getIndex(), getFixingPeriodStartTime(), getFixingPeriodEndTime(), getFixingAccrualFactor(), strike, _isCap); } } @Deprecated  CapFloorIbor(final Currency currency, final double paymentTime, final String fundingCurveName, final double paymentYearFraction, final double notional,
      final double fixingTime, final IborIndex index, final double fixingPeriodStartTime, final double fixingPeriodEndTime, final double fixingYearFraction,
      final String forwardCurveName, final double strike, final boolean isCap);  CapFloorIbor(final Currency currency, final double paymentTime, final double paymentYearFraction, final double notional, final double fixingTime, final IborIndex index,
      final double fixingPeriodStartTime, final double fixingPeriodEndTime, final double fixingYearFraction, final double strike, final boolean isCap); @SuppressWarnings("deprecation") CapFloorIbor withStrike(final double strike); @SuppressWarnings("deprecation") static CapFloorIbor from(final CouponIbor coupon, final double strike, final boolean isCap); IborIndex getIndex(); double getFixingPeriodStartTime(); double getFixingPeriodEndTime(); double getFixingAccrualFactor(); @Override double getStrike(); @Override boolean isCap(); @Deprecated String getForwardCurveName(); @Override double payOff(final double fixing); @SuppressWarnings("deprecation") @Override Coupon withNotional(final double notional); @SuppressWarnings("deprecation") CouponIborSpread toCoupon(); @Override T accept(final InstrumentDerivativeVisitor<S, T> visitor, final S data); @Override T accept(final InstrumentDerivativeVisitor<?, T> visitor); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void withStrike() { final double otherStrike = STRIKE + 0.01; final CapFloorIbor otherCap = new CapFloorIbor(CUR, PAYMENT_TIME, PAYMENT_YEAR_FRACTION, NOTIONAL, FIXING_TIME, INDEX, FIXING_START_TIME, FIXING_END_TIME, FIXING_YEAR_FRACTION, otherStrike, IS_CAP); final CapFloorIbor otherCapWith = CAP.withStrike(otherStrike); assertEquals("Strike", otherStrike, otherCapWith.getStrike()); assertEquals("Pay-off", otherCap, otherCapWith); }