CouponIborSpreadDefinition extends CouponFloatingDefinition { public static CouponIborSpreadDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime accrualEndDate, final double accrualFactor, final double notional, final IborIndex index, final double spread, final Calendar calendar) { final ZonedDateTime fixingDate = ScheduleCalculator.getAdjustedDate(accrualStartDate, -index.getSpotLag(), calendar); return new CouponIborSpreadDefinition(index.getCurrency(), accrualEndDate, accrualStartDate, accrualEndDate, accrualFactor, notional, fixingDate, index, spread, calendar); } CouponIborSpreadDefinition(final Currency currency, final ZonedDateTime paymentDate, final ZonedDateTime accrualStartDate, final ZonedDateTime accrualEndDate, final double accrualFactor,
      final double notional, final ZonedDateTime fixingDate, final IborIndex index, final double spread, final Calendar calendar);  CouponIborSpreadDefinition(final Currency currency, final ZonedDateTime paymentDate, final ZonedDateTime accrualStartDate, final ZonedDateTime accrualEndDate,
      final double paymentAccrualFactor, final double notional, final ZonedDateTime fixingDate, final ZonedDateTime fixingPeriodStartDate, final ZonedDateTime fixingPeriodEndDate,
      final double fixingPeriodAccrualFactor, final IborIndex index, final double spread, final Calendar calendar); static CouponIborSpreadDefinition from(final ZonedDateTime accrualStartDate, final ZonedDateTime accrualEndDate, final double accrualFactor, final double notional, final IborIndex index,
      final double spread, final Calendar calendar); static CouponIborSpreadDefinition from(final CouponIborDefinition couponIbor, final double spread); double getSpread(); double getSpreadAmount(); IborIndex getIndex(); ZonedDateTime getFixingPeriodStartDate(); ZonedDateTime getFixingPeriodEndDate(); double getFixingPeriodAccrualFactor(); Calendar getCalendar(); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override Coupon toDerivative(final ZonedDateTime dateTime); @Override Coupon toDerivative(final ZonedDateTime dateTime, final DoubleTimeSeries<ZonedDateTime> indexFixingTimeSeries); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullCoupon() { CouponIborSpreadDefinition.from(null, SPREAD); }
@Test public void from() { final ZonedDateTime accrualStartDate = DateUtils.getUTCDate(2011, 1, 3); final ZonedDateTime accrualEndDate = DateUtils.getUTCDate(2011, 4, 1); final double accrualFactor = 0.25; final CouponIborSpreadDefinition cpn = CouponIborSpreadDefinition.from(accrualStartDate, accrualEndDate, accrualFactor, NOTIONAL, INDEX, SPREAD, CALENDAR); assertEquals("CouponIborSpreadDefinition: from", NOTIONAL, cpn.getNotional()); assertEquals("CouponIborSpreadDefinition: from", SPREAD, cpn.getSpread()); assertEquals("CouponIborSpreadDefinition: from", accrualStartDate, cpn.getAccrualStartDate()); final ZonedDateTime fixingDate = ScheduleCalculator.getAdjustedDate(accrualStartDate, -INDEX.getSpotLag(), CALENDAR); assertEquals("CouponIborSpreadDefinition: from", fixingDate, cpn.getFixingDate()); assertEquals("CouponIborSpreadDefinition: from", accrualStartDate, cpn.getFixingPeriodStartDate()); final ZonedDateTime fixingPeriodEndDate = ScheduleCalculator.getAdjustedDate(accrualStartDate, INDEX, CALENDAR); assertEquals("CouponIborSpreadDefinition: from", fixingPeriodEndDate, cpn.getFixingPeriodEndDate()); }