CashOrNothingOptionDefinition extends OptionDefinition { @Override public OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction() { return _exerciseFunction; } CashOrNothingOptionDefinition(final double strike, final Expiry expiry, final boolean isCall, final double payment); @Override OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction(); @Override OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction(); double getPayment(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testExerciseFunction() { OptionExerciseFunction<StandardOptionDataBundle> f = CALL.getExerciseFunction(); assertFalse(f.shouldExercise(DATA.withSpot(SPOT + 1), null)); assertFalse(f.shouldExercise(DATA.withSpot(SPOT - 1), null)); f = PUT.getExerciseFunction(); assertFalse(f.shouldExercise(DATA.withSpot(SPOT + 1), null)); assertFalse(f.shouldExercise(DATA.withSpot(SPOT - 1), null)); }