AssetOrNothingOptionDefinition extends OptionDefinition { @Override public OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction() { return _payoffFunction; } AssetOrNothingOptionDefinition(final double strike, final Expiry expiry, final boolean isCall); @Override OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction(); @Override OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { CALL.getPayoffFunction().getPayoff(null, null); }
@Test public void testPayoffFunction() { assertEquals(CALL.getPayoffFunction().getPayoff(DATA, null), 0, 0); assertEquals(PUT.getPayoffFunction().getPayoff(DATA, null), 0, 0); StandardOptionDataBundle data = DATA.withSpot(STRIKE + DELTA); assertEquals(CALL.getPayoffFunction().getPayoff(data, null), STRIKE + DELTA, 0); assertEquals(PUT.getPayoffFunction().getPayoff(data, null), 0, 0); data = DATA.withSpot(STRIKE - DELTA); assertEquals(CALL.getPayoffFunction().getPayoff(data, null), 0, 0); assertEquals(PUT.getPayoffFunction().getPayoff(data, null), STRIKE - DELTA, 0); }