StandardTwoAssetOptionDataBundle { public StandardTwoAssetOptionDataBundle withCorrelation(final double correlation) { if (!ArgumentChecker.isInRangeInclusive(-1, 1, correlation)) { throw new IllegalArgumentException("Correlation must be between 0 and 1"); } return new StandardTwoAssetOptionDataBundle(getInterestRateCurve(), getFirstCostOfCarry(), getSecondCostOfCarry(), getFirstVolatilitySurface(), getSecondVolatilitySurface(), getFirstSpot(), getSecondSpot(), correlation, getDate()); } StandardTwoAssetOptionDataBundle(final YieldAndDiscountCurve interestRateCurve, final double b1, final double b2, final VolatilitySurface volatilitySurface1,
      final VolatilitySurface volatilitySurface2, final double spot1, final double spot2, final double rho, final ZonedDateTime date);  StandardTwoAssetOptionDataBundle(final StandardTwoAssetOptionDataBundle other); double getInterestRate(final double t); double getFirstCostOfCarry(); double getSecondCostOfCarry(); double getFirstVolatility(final double timeToExpiry, final double strike); double getSecondVolatility(final double timeToExpiry, final double strike); double getFirstSpot(); double getSecondSpot(); YieldAndDiscountCurve getInterestRateCurve(); VolatilitySurface getFirstVolatilitySurface(); VolatilitySurface getSecondVolatilitySurface(); double getCorrelation(); ZonedDateTime getDate(); StandardTwoAssetOptionDataBundle withInterestRateCurve(final YieldAndDiscountCurve interestRateCurve); StandardTwoAssetOptionDataBundle withFirstCostOfCarry(final double costOfCarry); StandardTwoAssetOptionDataBundle withSecondCostOfCarry(final double costOfCarry); StandardTwoAssetOptionDataBundle withFirstVolatilitySurface(final VolatilitySurface volatilitySurface); StandardTwoAssetOptionDataBundle withSecondVolatilitySurface(final VolatilitySurface volatilitySurface); StandardTwoAssetOptionDataBundle withFirstSpot(final double spot); StandardTwoAssetOptionDataBundle withSecondSpot(final double spot); StandardTwoAssetOptionDataBundle withCorrelation(final double correlation); StandardTwoAssetOptionDataBundle withDate(final ZonedDateTime date); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testSetLowCorrelation() { DATA.withCorrelation(-1 - RHO); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testSetHighCorrelation() { DATA.withCorrelation(1 + RHO); }