AnnuityDefinition implements InstrumentDefinitionWithData<Annuity<? extends Payment>, DoubleTimeSeries<ZonedDateTime>> { @Override public Annuity<? extends Payment> toDerivative(final ZonedDateTime date) { ArgumentChecker.notNull(date, "date"); final List<Payment> resultList = new ArrayList<>(); for (int loopcoupon = 0; loopcoupon < _payments.length; loopcoupon++) { if (!date.isAfter(_payments[loopcoupon].getPaymentDate())) { resultList.add(_payments[loopcoupon].toDerivative(date)); } } return new Annuity<>(resultList.toArray(new Payment[resultList.size()])); } AnnuityDefinition(final P[] payments, final Calendar calendar); P[] getPayments(); P getNthPayment(final int n); Currency getCurrency(); @Deprecated boolean isPayer(); int getNumberOfPayments(); Calendar getCalendar(); AnnuityDefinition<?> trimBefore(final ZonedDateTime trimDate); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override Annuity<? extends Payment> toDerivative(final ZonedDateTime date); @SuppressWarnings("unchecked") @Override Annuity<? extends Payment> toDerivative(final ZonedDateTime date, final DoubleTimeSeries<ZonedDateTime> indexFixingTS); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testConversionNullDate1() { FIXED_DEFINITION.toDerivative(null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testConversionNullDate2() { FIXED_DEFINITION.toDerivative(null, FIXING_TS); }