GeneratorDeposit extends GeneratorInstrument<GeneratorAttributeIR> { @Override public CashDefinition generateInstrument(final ZonedDateTime date, final double rate, final double notional, final GeneratorAttributeIR attribute) { ArgumentChecker.notNull(date, "Reference date"); ArgumentChecker.notNull(attribute, "Attributes"); final ZonedDateTime spot = ScheduleCalculator.getAdjustedDate(date, _spotLag, _calendar); final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spot, attribute.getStartPeriod(), this); final ZonedDateTime endDate = ScheduleCalculator.getAdjustedDate(startDate, attribute.getEndPeriod(), this); final double accrualFactor = _dayCount.getDayCountFraction(startDate, endDate, _calendar); return new CashDefinition(_currency, startDate, endDate, notional, rate, accrualFactor); } GeneratorDeposit(final String name, final Currency currency, final Calendar calendar, final int spotLag, final DayCount dayCount,
      final BusinessDayConvention businessDayConvention, final boolean endOfMonth); Currency getCurrency(); Calendar getCalendar(); int getSpotLag(); DayCount getDayCount(); BusinessDayConvention getBusinessDayConvention(); boolean isEndOfMonth(); @Override CashDefinition generateInstrument(final ZonedDateTime date, final double rate, final double notional, final GeneratorAttributeIR attribute); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void generateInstrument() { final ZonedDateTime referenceDate = DateUtils.getUTCDate(2012, 7, 17); final Period tenor = Period.ofMonths(6); final double rate = 0.01; final double notional = 12345; final GeneratorAttributeIR attribute = new GeneratorAttributeIR(tenor); final CashDefinition insGenerated = GENERATOR_DEPOSIT_USD.generateInstrument(referenceDate, rate, notional, attribute); final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(referenceDate, SETTLEMENT_DAYS, CALENDAR); final ZonedDateTime endDate = ScheduleCalculator.getAdjustedDate(startDate, tenor, BUSINESS_DAY, CALENDAR, IS_EOM); final double accrualFactor = DAY_COUNT.getDayCountFraction(startDate, endDate); final CashDefinition insExpected = new CashDefinition(CUR, startDate, endDate, notional, rate, accrualFactor); assertEquals("Generator Deposit: generate instrument", insExpected, insGenerated); }