BondCapitalIndexedTransactionDefinition extends BondTransactionDefinition<C, C> implements InstrumentDefinitionWithData<BondTransaction<? extends BondSecurity<? extends Payment, ? extends Coupon>>, DoubleTimeSeries<ZonedDateTime>> { @Override public BondCapitalIndexedTransaction<Coupon> toDerivative(final ZonedDateTime date) { final ImmutableZonedDateTimeDoubleTimeSeries series = ImmutableZonedDateTimeDoubleTimeSeries.ofEmpty(ZoneOffset.UTC); return toDerivative(date, series); } BondCapitalIndexedTransactionDefinition(final BondSecurityDefinition<C, C> underlyingBond, final double quantity, final ZonedDateTime settlementDate,
      final double price); @Override BondCapitalIndexedTransaction<Coupon> toDerivative(final ZonedDateTime date); @Override BondCapitalIndexedTransaction<Coupon> toDerivative(final ZonedDateTime date, final DoubleTimeSeries<ZonedDateTime> data); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor);  }
@Test public void toDerivative() { final DoubleTimeSeries<ZonedDateTime> ukRpi = MulticurveProviderDiscountDataSets.ukRpiFrom2010(); final ZonedDateTime pricingDate = DateUtils.getUTCDate(2011, 8, 3); final BondCapitalIndexedTransaction<Coupon> bondTransactionConverted = BOND_GILT_1_TRANSACTION_DEFINITION.toDerivative(pricingDate, ukRpi); final BondCapitalIndexedSecurity<Coupon> purchase = BOND_GILT_1_SECURITY_DEFINITION.toDerivative(pricingDate, SETTLE_DATE_GILT_1, ukRpi); assertEquals("Capital Index Bond: toDerivative", purchase, bondTransactionConverted.getBondTransaction()); final ZonedDateTime spot = ScheduleCalculator.getAdjustedDate(pricingDate, SETTLEMENT_DAYS_GILT_1, CALENDAR_GBP); final BondCapitalIndexedSecurity<Coupon> standard = BOND_GILT_1_SECURITY_DEFINITION.toDerivative(pricingDate, spot, ukRpi); assertEquals("Capital Index Bond: toDerivative", standard, bondTransactionConverted.getBondStandard()); final BondCapitalIndexedTransaction<Coupon> expected = new BondCapitalIndexedTransaction<>(purchase, QUANTITY, PRICE_GILT_1, standard, NOTIONAL_GILT_1); assertEquals("Capital Index Bond: toDerivative", expected, bondTransactionConverted); }