EuropeanStandardBarrierOptionDefinition extends OptionDefinition { @Override public OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction() { return _exerciseFunction; } EuropeanStandardBarrierOptionDefinition(final double strike, final Expiry expiry, final boolean isCall, final Barrier barrier);  EuropeanStandardBarrierOptionDefinition(final double strike, final Expiry expiry, final boolean isCall, final Barrier barrier, final double rebate); Barrier getBarrier(); double getRebate(); @Override OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction(); @Override OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction(); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testExercise() { EuropeanStandardBarrierOptionDefinition option = new EuropeanStandardBarrierOptionDefinition(STRIKE - 60, EXPIRY, true, BARRIER, REBATE); OptionExerciseFunction<StandardOptionDataBundle> f = option.getExerciseFunction(); assertFalse(f.shouldExercise(DATA, null)); option = new EuropeanStandardBarrierOptionDefinition(STRIKE - 60, EXPIRY, false, BARRIER, REBATE); f = option.getExerciseFunction(); assertFalse(f.shouldExercise(DATA, null)); option = new EuropeanStandardBarrierOptionDefinition(STRIKE + 60, EXPIRY, true, BARRIER, REBATE); f = option.getExerciseFunction(); assertFalse(f.shouldExercise(DATA, null)); option = new EuropeanStandardBarrierOptionDefinition(STRIKE + 60, EXPIRY, false, BARRIER, REBATE); f = option.getExerciseFunction(); assertFalse(f.shouldExercise(DATA, null)); }