EuropeanVanillaOptionDefinition extends OptionDefinition { @Override public OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction() { return _payoffFunction; } EuropeanVanillaOptionDefinition(final double strike, final Expiry expiry, final boolean isCall); @Override OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction(); @Override OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction(); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testPayoffFunction() { OptionPayoffFunction<StandardOptionDataBundle> payoff = CALL.getPayoffFunction(); assertEquals(payoff.getPayoff(DATA.withSpot(SPOT + DIFF), null), DIFF, EPS); assertEquals(payoff.getPayoff(DATA.withSpot(SPOT - DIFF), null), 0, EPS); payoff = PUT.getPayoffFunction(); assertEquals(payoff.getPayoff(DATA.withSpot(SPOT + DIFF), null), 0, EPS); assertEquals(payoff.getPayoff(DATA.withSpot(SPOT - DIFF), null), DIFF, EPS); }