GeneratorForexForward extends GeneratorInstrument<GeneratorAttributeFX> { @Override public ForexDefinition generateInstrument(final ZonedDateTime date, final double forwardPoints, final double notional, final GeneratorAttributeFX attribute) { ArgumentChecker.notNull(attribute, "Attribute"); final double fx = attribute.getFXMatrix().getFxRate(_currency1, _currency2); final ZonedDateTime spot = ScheduleCalculator.getAdjustedDate(date, _spotLag, _calendar); final ZonedDateTime endDate = ScheduleCalculator.getAdjustedDate(spot, attribute.getEndPeriod(), _businessDayConvention, _calendar, _endOfMonth); return new ForexDefinition(_currency1, _currency2, endDate, notional, fx + forwardPoints); } GeneratorForexForward(final String name, final Currency currency1, final Currency currency2, 
      final Calendar calendar, final int spotLag, final BusinessDayConvention businessDayConvention, 
      final boolean endOfMonth); Currency getCurrency1(); Currency getCurrency2(); Calendar getCalendar(); int getSpotLag(); BusinessDayConvention getBusinessDayConvention(); boolean isEndOfMonth(); @Override ForexDefinition generateInstrument(final ZonedDateTime date, final double forwardPoints, 
      final double notional, final GeneratorAttributeFX 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 pts = 0.01; final double eurUsd = 1.25; final double notional = 123000000; final FXMatrix fxMatrix = new FXMatrix(EUR, USD, eurUsd); final GeneratorAttributeFX attribute = new GeneratorAttributeFX(tenor, fxMatrix); final ForexDefinition insGenerated = GENERATOR_FX_EURUSD.generateInstrument(referenceDate, pts, notional, attribute); final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(referenceDate, SETTLEMENT_DAYS, CALENDAR); final ZonedDateTime endDate = ScheduleCalculator.getAdjustedDate(startDate, tenor, BUSINESS_DAY, CALENDAR, IS_EOM); final ForexDefinition insExpected = new ForexDefinition(EUR, USD, endDate, notional, eurUsd + pts); assertEquals("Generator FX Forward: generate instrument", insExpected, insGenerated); }