AnnuityCouponONSpreadSimplifiedDefinition extends AnnuityDefinition<CouponONSpreadSimplifiedDefinition> { public static AnnuityCouponONSpreadSimplifiedDefinition from(final ZonedDateTime settlementDate, final Period tenorAnnuity, final double notional, final double spread, final GeneratorSwapFixedON generator, final boolean isPayer) { ArgumentChecker.notNull(settlementDate, "settlement date"); ArgumentChecker.notNull(tenorAnnuity, "tenor annuity"); ArgumentChecker.notNull(generator, "generator"); final ZonedDateTime[] endFixingPeriodDate = ScheduleCalculator.getAdjustedDateSchedule(settlementDate, tenorAnnuity, generator.getLegsPeriod(), generator.getBusinessDayConvention(), generator.getOvernightCalendar(), generator.isEndOfMonth()); return AnnuityCouponONSpreadSimplifiedDefinition.from(settlementDate, endFixingPeriodDate, notional, spread, isPayer, generator.getIndex(), generator.getPaymentLag(), generator.getOvernightCalendar()); } AnnuityCouponONSpreadSimplifiedDefinition(final CouponONSpreadSimplifiedDefinition[] payments, final IndexON index, final Calendar calendar); static AnnuityCouponONSpreadSimplifiedDefinition from(final ZonedDateTime settlementDate, final Period tenorAnnuity, final double notional, final double spread,
      final GeneratorSwapFixedON generator,
      final boolean isPayer); static AnnuityCouponONSpreadSimplifiedDefinition from(final ZonedDateTime settlementDate, final ZonedDateTime maturityDate, final double notional, final double spread,
      final GeneratorSwapFixedON generator, final boolean isPayer); static AnnuityCouponONSpreadSimplifiedDefinition from(final ZonedDateTime settlementDate, final ZonedDateTime endFixingPeriodDate, final double notional, final double spread,
      final boolean isPayer, final Period paymentPeriod, final IndexON indexON, final int paymentLag, final BusinessDayConvention businessDayConvention, final boolean isEOM,
      final Calendar indexCalendar); static AnnuityCouponONSpreadSimplifiedDefinition from(final ZonedDateTime settlementDate, final ZonedDateTime endFixingPeriodDate, final double notional, final double spread,
      final boolean isPayer, final Period paymentPeriod, final IndexON indexON, final int paymentLag, final BusinessDayConvention businessDayConvention, final boolean isEOM,
      final Calendar indexCalendar, final StubType stub); static AnnuityCouponONSpreadSimplifiedDefinition from(final ZonedDateTime settlementDate, final Period tenorAnnuity, final double notional, final double spread, final boolean isPayer,
      final IndexON indexON, final int paymentLag, final Calendar indexCalendar, final BusinessDayConvention businessDayConvention, final Period paymentPeriod, final boolean isEOM); IndexON getIndex();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullSettlementDate1() { AnnuityCouponONSimplifiedDefinition.from(null, MATURITY_TENOR, NOTIONAL, GENERATOR, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullPaymentFrequency() { AnnuityCouponONSimplifiedDefinition.from(SETTLEMENT_DATE, (Period) null, NOTIONAL, GENERATOR, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullGenerator1() { AnnuityCouponONSimplifiedDefinition.from(SETTLEMENT_DATE, MATURITY_TENOR, NOTIONAL, null, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullSettlementDate2() { AnnuityCouponONSimplifiedDefinition.from(null, END_FIXING_DATE, NOTIONAL, GENERATOR, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullMaturityDate() { AnnuityCouponONSimplifiedDefinition.from(SETTLEMENT_DATE, (ZonedDateTime) null, NOTIONAL, GENERATOR, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullGenerator2() { AnnuityCouponONSimplifiedDefinition.from(SETTLEMENT_DATE, END_FIXING_DATE, NOTIONAL, null, IS_PAYER); }
@Test public void from() { final AnnuityCouponONSpreadSimplifiedDefinition annuity = AnnuityCouponONSpreadSimplifiedDefinition.from(SETTLEMENT_DATE, END_FIXING_DATE, NOTIONAL, SPREAD, IS_PAYER, PAYMENT_PERIOD, EONIA, 2, BUSINESS_DAY, IS_EOM, CALENDAR); final int nbCouponComputed = annuity.getNumberOfPayments(); final int nbCouponExpected = 20; assertEquals("AnnuityCouponONSpreadSimplifiedDefinition: from", nbCouponExpected, nbCouponComputed); assertEquals("AnnuityCouponONSpreadSimplifiedDefinition: from", SETTLEMENT_DATE, annuity.getNthPayment(0).getFixingPeriodStartDate()); assertEquals("AnnuityCouponONSpreadSimplifiedDefinition: from", SETTLEMENT_DATE, annuity.getNthPayment(0).getAccrualStartDate()); assertEquals("AnnuityCouponONSpreadSimplifiedDefinition: from", END_FIXING_DATE, annuity.getNthPayment(nbCouponComputed - 1).getFixingPeriodEndDate()); assertEquals("AnnuityCouponONSpreadSimplifiedDefinition: from", END_FIXING_DATE, annuity.getNthPayment(nbCouponComputed - 1).getAccrualEndDate()); for (int loopcpn = 0; loopcpn < nbCouponComputed; loopcpn++) { assertEquals("AnnuityCouponONSpreadSimplifiedDefinition: from", NOTIONAL * (IS_PAYER ? -1.0 : 1.0), annuity.getNthPayment(loopcpn).getNotional()); assertEquals("AnnuityCouponONSpreadSimplifiedDefinition: from", SPREAD, annuity.getNthPayment(loopcpn).getSpread()); } }