SVIVolatilityFunction extends VolatilityFunctionProvider<SVIFormulaData> { @Override public Function1D<SVIFormulaData, Double> getVolatilityFunction(final EuropeanVanillaOption option, final double forward) { Validate.notNull(option, "option"); Validate.isTrue(forward > 0, "Need forward >= 0"); final double strike = option.getStrike(); Validate.isTrue(strike > 0, "Need strike >= 0"); final double kappa = Math.log(strike / forward); return new Function1D<SVIFormulaData, Double>() { @SuppressWarnings("synthetic-access") @Override public Double evaluate(final SVIFormulaData data) { return getVolatility(kappa, data); } }; }  @Override Function1D<SVIFormulaData, Double> getVolatilityFunction(final EuropeanVanillaOption option, final double forward); @ExternalFunction double getVolatility(final double forward, final double strike, final double a, final double b, final double rho,
      final double nu, final double m); double getVolatility(final double forward, final double strike, final SVIFormulaData data); @Override Function1D<SVIFormulaData, double[]> getVolatilityAdjointFunction(final EuropeanVanillaOption option, final double forward); @Override Function1D<SVIFormulaData, double[][]> getVolatilityAdjointFunction(final double forward, final double[] strikes, final double timeToExpiry); @Override Function1D<SVIFormulaData, double[]> getModelAdjointFunction(final EuropeanVanillaOption option, final double forward); @Override Function1D<SVIFormulaData, double[][]> getModelAdjointFunction(final double forward, final double[] strikes, final double timeToExpiry); @ExternalFunction double[] getVolatilityAjoint(final double forward, final double strike, final double a, final double b, final double rho, final double nu, final double m); double[] getVolatilityAjoint(final double forward, final double strike, final SVIFormulaData data); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullOption() { FUNC.getVolatilityFunction(null, 0); }