RelativeOutperformanceOptionDefinition extends OptionDefinition { @SuppressWarnings("unchecked") @Override public OptionPayoffFunction<StandardTwoAssetOptionDataBundle> getPayoffFunction() { return _payoffFunction; } RelativeOutperformanceOptionDefinition(final double strike, final Expiry expiry, final boolean isCall); @SuppressWarnings("unchecked") @Override OptionExerciseFunction<StandardTwoAssetOptionDataBundle> getExerciseFunction(); @SuppressWarnings("unchecked") @Override OptionPayoffFunction<StandardTwoAssetOptionDataBundle> getPayoffFunction();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { new RelativeOutperformanceOptionDefinition(K, EXPIRY, true).getPayoffFunction().getPayoff(null, null); }
@Test public void testPayoff() { final RelativeOutperformanceOptionDefinition call = new RelativeOutperformanceOptionDefinition(K, EXPIRY, true); final RelativeOutperformanceOptionDefinition put = new RelativeOutperformanceOptionDefinition(K, EXPIRY, false); final double eps = 1e-12; assertEquals(call.getPayoffFunction().getPayoff(DATA, null), 0, eps); assertEquals(put.getPayoffFunction().getPayoff(DATA, null), 1. / 6, eps); final StandardTwoAssetOptionDataBundle data = DATA.withSecondSpot(80); assertEquals(call.getPayoffFunction().getPayoff(data, null), 1. / 4, eps); assertEquals(put.getPayoffFunction().getPayoff(data, null), 0, eps); }