ComplexChooserOptionDefinition extends OptionDefinition { @Override public OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction() { return _payoffFunction; } ComplexChooserOptionDefinition(final Expiry chooseDate, final double callStrike, final Expiry callExpiry, final double putStrike, final Expiry putExpiry); double getCallStrike(); double getPutStrike(); Expiry getCallExpiry(); Expiry getPutExpiry(); double getTimeToCallExpiry(final ZonedDateTime date); double getTimeToPutExpiry(final ZonedDateTime date); OptionDefinition getCallDefinition(); OptionDefinition getPutDefinition(); @Override OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction(); @Override OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testPayoffFunction() { StandardOptionDataBundle data = DATA.withSpot(CALL_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(PUT_STRIKE - DIFF); assertEquals(MODEL.getGreeks(VANILLA_PUT, data, PRICE).get(Greek.FAIR_PRICE), payoff.getPayoff(data, null), EPS); }