SimpleChooserOptionDefinition extends OptionDefinition { @Override public OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction() { return _payoffFunction; } SimpleChooserOptionDefinition(final Expiry chooseDate, final double underlyingStrike, final Expiry underlyingExpiry); OptionDefinition getCallDefinition(); OptionDefinition getPutDefinition(); double getUnderlyingStrike(); Expiry getUnderlyingExpiry(); @Override OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction(); @Override OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDataBundle() { CHOOSER.getPayoffFunction().getPayoff(null, null); }
@Test public void testPayoffFunction() { StandardOptionDataBundle data = DATA.withSpot(STRIKE + DIFF); final OptionPayoffFunction<StandardOptionDataBundle> payoff = CHOOSER.getPayoffFunction(); assertEquals(MODEL.getGreeks(VANILLA_CALL, data, PRICE).get(Greek.FAIR_PRICE), payoff.getPayoff(data, null), EPS); data = DATA.withSpot(STRIKE - DIFF); assertEquals(MODEL.getGreeks(VANILLA_PUT, data, PRICE).get(Greek.FAIR_PRICE), payoff.getPayoff(data, null), EPS); }