@Override
 protected Set<ComputedValue> getResult(
     final InstrumentDerivative fxDigital,
     final ForexOptionDataBundle<?> data,
     final ComputationTarget target,
     final Set<ValueRequirement> desiredValues,
     final FunctionInputs inputs,
     final ValueSpecification spec,
     final FunctionExecutionContext executionContext) {
   final String spreadName =
       Iterables.getOnlyElement(desiredValues)
           .getConstraint(CalculationPropertyNamesAndValues.PROPERTY_CALL_SPREAD_VALUE);
   final double spread = Double.parseDouble(spreadName);
   final PresentValueBlackVolatilitySensitivityCallSpreadBlackForexCalculator calculator =
       new PresentValueBlackVolatilitySensitivityCallSpreadBlackForexCalculator(spread);
   final PresentValueForexBlackVolatilitySensitivity result = fxDigital.accept(calculator, data);
   final CurrencyAmount vegaValue = result.toSingleValue();
   return Collections.singleton(new ComputedValue(spec, vegaValue.getAmount()));
 }
 @Test
 /** Tests the present value volatility sensitivity. Method vs Calculator. */
 public void presentValueVolatilitySensitivityMethodVCalculator() {
   PresentValueForexBlackVolatilitySensitivity pvbvMethod =
       METHOD_DIGITAL_SPREAD.presentValueVolatilitySensitivity(FOREX_CALL_OPTION, SMILE_BUNDLE);
   PresentValueVolatilitySensitivityCallSpreadBlackForexCalculator calculator =
       new PresentValueVolatilitySensitivityCallSpreadBlackForexCalculator(STANDARD_SPREAD);
   PresentValueForexBlackVolatilitySensitivity pvbvCalculator =
       calculator.visit(FOREX_CALL_OPTION, SMILE_BUNDLE);
   assertTrue(
       "Forex Digital option: call spread method - present value volatility sensitivity",
       PresentValueForexBlackVolatilitySensitivity.compare(
           pvbvMethod, pvbvCalculator, TOLERANCE_DELTA));
 }
 @Test
 /** Tests the present value curve sensitivity. */
 public void presentValueVolatilitySensitivity() {
   double strikeM = STRIKE * (1 - STANDARD_SPREAD);
   double strikeP = STRIKE * (1 + STANDARD_SPREAD);
   Forex forexM =
       new Forex(
           FOREX.getPaymentCurrency1().withAmount(1.0),
           FOREX.getPaymentCurrency2().withAmount(-strikeM));
   Forex forexP =
       new Forex(
           FOREX.getPaymentCurrency1().withAmount(1.0),
           FOREX.getPaymentCurrency2().withAmount(-strikeP));
   ForexOptionVanilla vanillaM =
       new ForexOptionVanilla(forexM, FOREX_CALL_OPTION.getExpirationTime(), IS_CALL, IS_LONG);
   ForexOptionVanilla vanillaP =
       new ForexOptionVanilla(forexP, FOREX_CALL_OPTION.getExpirationTime(), IS_CALL, IS_LONG);
   PresentValueForexBlackVolatilitySensitivity pvbvP =
       METHOD_VANILLA_BLACK.presentValueVolatilitySensitivity(vanillaP, SMILE_BUNDLE);
   PresentValueForexBlackVolatilitySensitivity pvbvM =
       METHOD_VANILLA_BLACK.presentValueVolatilitySensitivity(vanillaM, SMILE_BUNDLE);
   PresentValueForexBlackVolatilitySensitivity pvbvExpected =
       pvbvM
           .plus(pvbvP.multipliedBy(-1.0))
           .multipliedBy(
               1.0 / (strikeP - strikeM) * Math.abs(FOREX.getPaymentCurrency2().getAmount()));
   PresentValueForexBlackVolatilitySensitivity pvbvComputed =
       METHOD_DIGITAL_SPREAD.presentValueVolatilitySensitivity(FOREX_CALL_OPTION, SMILE_BUNDLE);
   assertEquals(
       "Forex Digital option: call spread method - present value volatility sensitivity",
       pvbvComputed.getVega().getMap().size(),
       2);
   assertTrue(
       "Forex Digital option: call spread method - present value volatility sensitivity",
       PresentValueForexBlackVolatilitySensitivity.compare(
           pvbvExpected, pvbvComputed, TOLERANCE_DELTA));
 }