SupershareOptionDefinition extends OptionDefinition { @Override public OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction() { return _payoffFunction; } SupershareOptionDefinition(final Expiry expiry, final double lowerBound, final double upperBound); @Override OptionExerciseFunction<StandardOptionDataBundle> getExerciseFunction(); @Override OptionPayoffFunction<StandardOptionDataBundle> getPayoffFunction(); double getLowerBound(); double getUpperBound(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { OPTION.getPayoffFunction().getPayoff(null, null); }
@Test public void testPayoff() { final OptionPayoffFunction<StandardOptionDataBundle> f = OPTION.getPayoffFunction(); assertEquals(f.getPayoff(DATA, null), SPOT / LOWER, 0); StandardOptionDataBundle data = DATA.withSpot(5); assertEquals(f.getPayoff(data, null), 0, 0); data = DATA.withSpot(35); assertEquals(f.getPayoff(data, null), 0, 0); data = DATA.withSpot(LOWER); assertEquals(f.getPayoff(data, null), LOWER / LOWER, 0); data = DATA.withSpot(UPPER); assertEquals(f.getPayoff(data, null), 0, 0); }