@Test public void testExerciseFunction() { StandardOptionDataBundle data = DATA.withSpot(STRIKE + DELTA); assertFalse(CALL.getExerciseFunction().shouldExercise(data, null)); assertFalse(PUT.getExerciseFunction().shouldExercise(data, null)); data = DATA.withSpot(STRIKE - DELTA); assertFalse(CALL.getExerciseFunction().shouldExercise(data, null)); assertFalse(PUT.getExerciseFunction().shouldExercise(data, null)); }
@Test public void testPayoffFunction() { assertEquals(CALL.getPayoffFunction().getPayoff(DATA, null), 0, 0); assertEquals(PUT.getPayoffFunction().getPayoff(DATA, null), 0, 0); double spot = STRIKE + DELTA; StandardOptionDataBundle data = DATA.withSpot(spot); assertEquals(CALL.getPayoffFunction().getPayoff(data, null), spot - PAYOFF_STRIKE, 0); assertEquals(PUT.getPayoffFunction().getPayoff(data, null), 0, 0); spot = STRIKE - DELTA; data = DATA.withSpot(spot); assertEquals(CALL.getPayoffFunction().getPayoff(data, null), 0, 0); assertEquals(PUT.getPayoffFunction().getPayoff(data, null), PAYOFF_STRIKE - spot, 0); }