@Test
 public void test() {
   assertEquals(MODEL.getPricingFunction(END).evaluate(DATA), 0, 0);
   assertEquals(
       MODEL
           .getPricingFunction(FORWARD)
           .evaluate(
               DATA.withVolatilitySurface(
                   new VolatilitySurface(ConstantDoublesSurface.from(1e-9)))),
       0,
       0);
   assertEquals(
       MODEL.getPricingFunction(NOW).evaluate(DATA),
       BSM.getPricingFunction(VANILLA).evaluate(DATA),
       1e-4);
   assertEquals(MODEL.getPricingFunction(FORWARD).evaluate(DATA), 4.4064, 1e-4);
 }
 @Test
 public void test() {
   // TODO test wrt BSM
   // final double spot = 2;
   // final StandardOptionDataBundle data = DATA.withSpot(spot);
   // final ComplexChooserOptionDefinition chooser = new ComplexChooserOptionDefinition(new
   // Expiry(DATE), CALL_STRIKE, CALL_EXPIRY, PUT_STRIKE, PUT_EXPIRY);
   // assertEquals(MODEL.getPricingFunction(chooser).evaluate(data), BSM.getPricingFunction(
   // new EuropeanVanillaOptionDefinition(CALL_STRIKE, new
   // Expiry(DateUtil.getDateOffsetWithYearFraction(DATE, CALL_LIFE)), true)).evaluate(data), 0);
   assertEquals(MODEL.getPricingFunction(CHOOSER).evaluate(DATA), 6.0508, 1e-4);
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testNullData() {
   MODEL
       .getPricingFunction(new AsymmetricPowerOptionDefinition(STRIKE, EXPIRY, 1, true))
       .evaluate((StandardOptionDataBundle) null);
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testNullDefinition() {
   MODEL.getPricingFunction(null);
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testNullData() {
   MODEL.getPricingFunction(FORWARD).evaluate((StandardOptionDataBundle) null);
 }
 @Test
 public void test() {
   OptionDefinition call = new EuropeanVanillaOptionDefinition(80, EXPIRY1, true);
   BatesGeneralizedJumpDiffusionModelDataBundle data =
       new BatesGeneralizedJumpDiffusionModelDataBundle(
           CURVE, B, SURFACE, SPOT, DATE, 0., -0.04, 0.);
   assertEquals(
       BSM.getPricingFunction(call).evaluate(data),
       MODEL.getPricingFunction(call).evaluate(data),
       EPS2);
   call = new EuropeanVanillaOptionDefinition(80, EXPIRY1, true);
   data = data.withLambda(1.).withDelta(0.1);
   assertEquals(20.67, MODEL.getPricingFunction(call).evaluate(data), EPS1);
   call = new EuropeanVanillaOptionDefinition(90, EXPIRY2, true);
   data = data.withLambda(5.);
   assertEquals(14.13, MODEL.getPricingFunction(call).evaluate(data), EPS1);
   call = new EuropeanVanillaOptionDefinition(100, EXPIRY3, true);
   data = data.withLambda(10.);
   assertEquals(13.62, MODEL.getPricingFunction(call).evaluate(data), EPS1);
   data = data.withDelta(0.25);
   data = data.withLambda(1.);
   call = new EuropeanVanillaOptionDefinition(90, EXPIRY1, true);
   assertEquals(11.57, MODEL.getPricingFunction(call).evaluate(data), EPS1);
   call = new EuropeanVanillaOptionDefinition(100, EXPIRY2, true);
   data = data.withLambda(5.);
   assertEquals(12.25, MODEL.getPricingFunction(call).evaluate(data), EPS1);
   call = new EuropeanVanillaOptionDefinition(110, EXPIRY3, true);
   data = data.withLambda(10.);
   assertEquals(20.43, MODEL.getPricingFunction(call).evaluate(data), EPS1);
   data = data.withDelta(0.5);
   data = data.withLambda(1.);
   call = new EuropeanVanillaOptionDefinition(100, EXPIRY1, true);
   assertEquals(5.18, MODEL.getPricingFunction(call).evaluate(data), EPS1);
   call = new EuropeanVanillaOptionDefinition(110, EXPIRY2, true);
   data = data.withLambda(5.);
   assertEquals(16.52, MODEL.getPricingFunction(call).evaluate(data), EPS1);
   call = new EuropeanVanillaOptionDefinition(120, EXPIRY3, true);
   data = data.withLambda(10.);
   assertEquals(37.03, MODEL.getPricingFunction(call).evaluate(data), EPS1);
 }
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testNullData() {
   MODEL
       .getPricingFunction(new EuropeanVanillaOptionDefinition(100, EXPIRY1, true))
       .evaluate((BatesGeneralizedJumpDiffusionModelDataBundle) null);
 }