ForexDefinition implements InstrumentDefinition<InstrumentDerivative> { public static ForexDefinition fromAmounts(final Currency currency1, final Currency currency2, final ZonedDateTime exchangeDate, final double amountCurrency1, final double amountCurrency2) { ArgumentChecker.notNull(currency1, "Currency 1"); ArgumentChecker.notNull(currency2, "Currency 2"); ArgumentChecker.notNull(exchangeDate, "Exchange date"); final PaymentFixedDefinition paymentCurrency1 = new PaymentFixedDefinition(currency1, exchangeDate, amountCurrency1); final PaymentFixedDefinition paymentCurrency2 = new PaymentFixedDefinition(currency2, exchangeDate, amountCurrency2); return new ForexDefinition(paymentCurrency1, paymentCurrency2); } ForexDefinition(final Currency currency1, final Currency currency2, final ZonedDateTime exchangeDate, final double amountCurrency1, final double fxRate);  ForexDefinition(final PaymentFixedDefinition paymentCurrency1, final PaymentFixedDefinition paymentCurrency2); static ForexDefinition fromAmounts(final Currency currency1, final Currency currency2, final ZonedDateTime exchangeDate, final double amountCurrency1,
      final double amountCurrency2); PaymentFixedDefinition getPaymentCurrency1(); PaymentFixedDefinition getPaymentCurrency2(); Currency getCurrency1(); Currency getCurrency2(); ZonedDateTime getExchangeDate(); @Override Forex toDerivative(final ZonedDateTime date); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void wrongSign2() { ForexDefinition.fromAmounts(CUR_1, CUR_2, PAYMENT_DATE, NOMINAL_1, NOMINAL_1); }
@Test public void from() { final ForexDefinition fXfrom = ForexDefinition.fromAmounts(CUR_1, CUR_2, PAYMENT_DATE, NOMINAL_1, -FX_RATE * NOMINAL_1); assertEquals("ForexDefinition builder", FX, fXfrom); }