TwoAssetCorrelationOptionDefinition extends OptionDefinition { @SuppressWarnings("unchecked") @Override public OptionPayoffFunction<StandardTwoAssetOptionDataBundle> getPayoffFunction() { return _payoffFunction; } TwoAssetCorrelationOptionDefinition(final double strike, final Expiry expiry, final boolean isCall, final double payoutLevel); @SuppressWarnings("unchecked") @Override OptionExerciseFunction<StandardTwoAssetOptionDataBundle> getExerciseFunction(); @SuppressWarnings("unchecked") @Override OptionPayoffFunction<StandardTwoAssetOptionDataBundle> getPayoffFunction(); double getPayoutLevel(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { CALL.getPayoffFunction().getPayoff(null, null); }
@Test public void testPayoff() { assertEquals(CALL.getPayoffFunction().getPayoff(DATA, null), 0, 0); assertEquals(PUT.getPayoffFunction().getPayoff(DATA, null), 0, 0); TwoAssetCorrelationOptionDefinition other = new TwoAssetCorrelationOptionDefinition(70, EXPIRY, true, 60); assertEquals(other.getPayoffFunction().getPayoff(DATA, null), 20, 0); other = new TwoAssetCorrelationOptionDefinition(70, EXPIRY, false, 120); assertEquals(other.getPayoffFunction().getPayoff(DATA.withFirstSpot(50), null), 40, 0); }