ForexOptionSingleBarrierDefinition implements InstrumentDefinition<InstrumentDerivative> { @Override public ForexOptionSingleBarrier toDerivative(final ZonedDateTime date) { ArgumentChecker.notNull(date, "date"); final ForexOptionVanilla underlying = _underlyingOption.toDerivative(date); return new ForexOptionSingleBarrier(underlying, _barrier); } ForexOptionSingleBarrierDefinition(final ForexOptionVanillaDefinition underlyingOption, final Barrier barrier);  ForexOptionSingleBarrierDefinition(final ForexOptionVanillaDefinition underlyingOption, final Barrier barrier, final double rebate); ForexOptionVanillaDefinition getUnderlyingOption(); Barrier getBarrier(); double getRebate(); @Override ForexOptionSingleBarrier toDerivative(final ZonedDateTime date); @Override V accept(final InstrumentDefinitionVisitor<U, V> visitor, final U data); @Override V accept(final InstrumentDefinitionVisitor<?, V> visitor); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDate() { OPTION.toDerivative(null); }
@Test public void testToDerivative() { final ForexOptionSingleBarrier derivative = OPTION.toDerivative(DATE); assertEquals(derivative.getUnderlyingOption(), UNDERLYING.toDerivative(DATE)); assertEquals(derivative.getBarrier(), BARRIER); }