AnnuityCouponFixedDefinition extends AnnuityDefinition<CouponFixedDefinition> { public static AnnuityCouponFixedDefinition from(final Currency currency, final ZonedDateTime settlementDate, final Period tenor, final Period paymentPeriod, final Calendar calendar, final DayCount dayCount, final BusinessDayConvention businessDay, final boolean isEOM, final double notional, final double fixedRate, final boolean isPayer) { ArgumentChecker.notNull(settlementDate, "settlement date"); ArgumentChecker.notNull(tenor, "Tenor"); final ZonedDateTime maturityDate = settlementDate.plus(tenor); return from(currency, settlementDate, maturityDate, paymentPeriod, calendar, dayCount, businessDay, isEOM, notional, fixedRate, isPayer); } AnnuityCouponFixedDefinition(final CouponFixedDefinition[] payments, final Calendar calendar); static AnnuityCouponFixedDefinition from(final Currency currency, final ZonedDateTime settlementDate, final Period tenor, final Period paymentPeriod, final Calendar calendar,
      final DayCount dayCount, final BusinessDayConvention businessDay, final boolean isEOM, final double notional, final double fixedRate, final boolean isPayer); static AnnuityCouponFixedDefinition from(final Currency currency, final ZonedDateTime settlementDate, final ZonedDateTime maturityDate, final Period paymentPeriod, final Calendar calendar,
      final DayCount dayCount, final BusinessDayConvention businessDay, final boolean isEOM, final double notional, final double fixedRate, final boolean isPayer); static AnnuityCouponFixedDefinition from(final Currency currency, final ZonedDateTime settlementDate, final ZonedDateTime maturityDate, final Period paymentPeriod, final Calendar calendar,
      final DayCount dayCount, final BusinessDayConvention businessDay, final boolean isEOM, final double notional, final double fixedRate, final boolean isPayer, final StubType stub); static AnnuityCouponFixedDefinition from(final Currency currency, final ZonedDateTime settlementDate, final ZonedDateTime maturityDate, final Frequency frequency, final Calendar calendar,
      final DayCount dayCount, final BusinessDayConvention businessDay, final boolean isEOM, final double notional, final double fixedRate, final boolean isPayer); static AnnuityCouponFixedDefinition from(final Currency currency, final ZonedDateTime settlementDate, final ZonedDateTime[] paymentDatesUnadjusted, final Frequency frequency,
      final Calendar calendar, final DayCount dayCount, final BusinessDayConvention businessDay, final boolean isEOM, final double notional, final double fixedRate, final boolean isPayer); static AnnuityCouponFixedDefinition from(final ZonedDateTime settlementDate, final Period tenor, final GeneratorSwapFixedIbor generator, final double notional, final double fixedRate,
      final boolean isPayer); static AnnuityCouponFixedDefinition fromAccrualUnadjusted(final Currency currency, final ZonedDateTime settlementDate, final ZonedDateTime maturityDate, final Period period,
      final boolean stubShort, final boolean fromEnd, final Calendar calendar, final DayCount dayCount, final BusinessDayConvention businessDay, final boolean isEOM, final double notional,
      final double fixedRate, final boolean isPayer); static AnnuityCouponFixedDefinition fromAccrualUnadjusted(final Currency currency, final ZonedDateTime settlementDate, final ZonedDateTime maturityDate, final Period period,
      final int nbPaymentPerYear, final boolean stubShort, final boolean fromEnd, final Calendar calendar, final DayCount dayCount, final BusinessDayConvention businessDay, final boolean isEOM,
      final double notional, final double fixedRate, final boolean isPayer); @Override AnnuityCouponFixedDefinition trimBefore(final ZonedDateTime trimDate); AnnuityCouponFixedDefinition trimStart(final ZonedDateTime trimDate); @Override AnnuityCouponFixed toDerivative(final ZonedDateTime date); AnnuityCouponFixedDefinition withRate(final double rate);  }
@Test public void testPaymentDates() { AnnuityCouponFixedDefinition fixedAnnuity; ZonedDateTime[] expectedPaymentDate; fixedAnnuity = AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, ANNUITY_TENOR, PAYMENT_TENOR, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); expectedPaymentDate = new ZonedDateTime[] {DateUtils.getUTCDate(2011, 9, 19), DateUtils.getUTCDate(2012, 3, 19), DateUtils.getUTCDate(2012, 9, 17), DateUtils.getUTCDate(2013, 3, 18) }; for (int loopcpn = 0; loopcpn < expectedPaymentDate.length; loopcpn++) { assertEquals(expectedPaymentDate[loopcpn], fixedAnnuity.getNthPayment(loopcpn).getPaymentDate()); } final ZonedDateTime settlementDateModified = DateUtils.getUTCDate(2011, 3, 31); fixedAnnuity = AnnuityCouponFixedDefinition.from(CUR, settlementDateModified, ANNUITY_TENOR, PAYMENT_TENOR, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); expectedPaymentDate = new ZonedDateTime[] {DateUtils.getUTCDate(2011, 9, 30), DateUtils.getUTCDate(2012, 3, 30), DateUtils.getUTCDate(2012, 9, 28), DateUtils.getUTCDate(2013, 3, 29) }; for (int loopcpn = 0; loopcpn < expectedPaymentDate.length; loopcpn++) { assertEquals(expectedPaymentDate[loopcpn], fixedAnnuity.getNthPayment(loopcpn).getPaymentDate()); } final ZonedDateTime settlementDateEOM = DateUtils.getUTCDate(2011, 2, 28); fixedAnnuity = AnnuityCouponFixedDefinition.from(CUR, settlementDateEOM, ANNUITY_TENOR, PAYMENT_TENOR, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); expectedPaymentDate = new ZonedDateTime[] {DateUtils.getUTCDate(2011, 8, 31), DateUtils.getUTCDate(2012, 2, 29), DateUtils.getUTCDate(2012, 8, 31), DateUtils.getUTCDate(2013, 2, 28) }; for (int loopcpn = 0; loopcpn < expectedPaymentDate.length; loopcpn++) { assertEquals(expectedPaymentDate[loopcpn], fixedAnnuity.getNthPayment(loopcpn).getPaymentDate()); } }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullCurrency1() { AnnuityCouponFixedDefinition.from(null, SETTLEMENT_DATE, PAYMENT_TENOR, ANNUITY_TENOR, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullSettlementDate1() { AnnuityCouponFixedDefinition.from(CUR, null, PAYMENT_TENOR, ANNUITY_TENOR, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullTenorPeriod() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, (Period) null, ANNUITY_TENOR, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullPaymentTenor1() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, PAYMENT_TENOR, null, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullCalendar1() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, PAYMENT_TENOR, ANNUITY_TENOR, null, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullDayCount1() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, PAYMENT_TENOR, ANNUITY_TENOR, CALENDAR, null, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullBusinessDay1() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, PAYMENT_TENOR, ANNUITY_TENOR, CALENDAR, DAY_COUNT, null, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullCurrency2() { AnnuityCouponFixedDefinition.from(null, SETTLEMENT_DATE, MATURITY_DATE, PAYMENT_FREQUENCY, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullSettlementDate2() { AnnuityCouponFixedDefinition.from(CUR, null, MATURITY_DATE, PAYMENT_FREQUENCY, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullMaturityDate() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, (ZonedDateTime) null, PAYMENT_FREQUENCY, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullPaymentFrequency() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, MATURITY_DATE, (PeriodFrequency) null, CALENDAR, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullCalendar2() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, MATURITY_DATE, PAYMENT_FREQUENCY, null, DAY_COUNT, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullDayCount2() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, MATURITY_DATE, PAYMENT_FREQUENCY, CALENDAR, null, BUSINESS_DAY, IS_EOM, NOTIONAL, RATE, IS_PAYER); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testStaticConstructionNullBusinessDay2() { AnnuityCouponFixedDefinition.from(CUR, SETTLEMENT_DATE, MATURITY_DATE, PAYMENT_FREQUENCY, CALENDAR, DAY_COUNT, null, IS_EOM, NOTIONAL, RATE, IS_PAYER); }