GeneratorInterestRateFutures extends GeneratorInstrument<GeneratorAttribute> { @Override public InterestRateFutureTransactionDefinition generateInstrument(final ZonedDateTime date, final double marketQuote, final double notional, final GeneratorAttribute attribute) { final int quantity = (int) Math.ceil(notional / _security.getNotional()); return new InterestRateFutureTransactionDefinition(_security, quantity, date, marketQuote); } GeneratorInterestRateFutures(final String name, final InterestRateFutureSecurityDefinition security); InterestRateFutureSecurityDefinition getFutures(); @Override InterestRateFutureTransactionDefinition generateInstrument(final ZonedDateTime date, final double marketQuote, final double notional, final GeneratorAttribute attribute); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void generateInstrument() { final ZonedDateTime referenceDate = DateUtils.getUTCDate(2012, 7, 17); final double price = 0.99; final double notional = 2000000; final int quantity = (int) Math.ceil(notional / NOTIONAL); final GeneratorAttribute attribute = new GeneratorAttribute(); final InterestRateFutureTransactionDefinition insGenerated = GENERATOR_FUTURES_ED.generateInstrument(referenceDate, price, notional, attribute); final InterestRateFutureTransactionDefinition insExpected = new InterestRateFutureTransactionDefinition(FUTURES_DEFINITION, quantity, referenceDate, price); assertEquals("Generator Deposit: generate instrument", insExpected, insGenerated); }