ExtremeSpreadOptionDefinition extends OptionDefinition { @SuppressWarnings("unchecked") @Override public OptionPayoffFunction<StandardOptionWithSpotTimeSeriesDataBundle> getPayoffFunction() { return _payoffFunction; } ExtremeSpreadOptionDefinition(final Expiry expiry, final boolean isCall, final Expiry periodEnd, final boolean isReverse); @SuppressWarnings("unchecked") @Override OptionExerciseFunction<StandardOptionWithSpotTimeSeriesDataBundle> getExerciseFunction(); @SuppressWarnings("unchecked") @Override OptionPayoffFunction<StandardOptionWithSpotTimeSeriesDataBundle> getPayoffFunction(); double getTimeFromPeriodEnd(final ZonedDateTime date); Expiry getPeriodEnd(); boolean isReverse(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testPayoff() { assertEquals(CALL.getPayoffFunction().getPayoff(DATA, null), 13, 0); assertEquals(CALL_REVERSE.getPayoffFunction().getPayoff(DATA, null), 0, 0); assertEquals(PUT.getPayoffFunction().getPayoff(DATA, null), 0, 0); assertEquals(PUT_REVERSE.getPayoffFunction().getPayoff(DATA, null), 13, 0); }