### Question:
SsviVolatilityFunction extends VolatilityFunctionProvider<SsviFormulaData> implements ImmutableBean, Serializable { @Override public double volatility(double forward, double strike, double timeToExpiry, SsviFormulaData data) { ArgChecker.isTrue(timeToExpiry > MIN_TIME_TO_EXPIRY, "time to expiry must not be zero to be able to compute volatility"); double volatilityAtm = data.getSigma(); double rho = data.getRho(); double eta = data.getEta(); double theta = volatilityAtm * volatilityAtm * timeToExpiry; double phi = eta / Math.sqrt(theta); double k = Math.log(strike / forward); double w = 0.5 * theta * (1.0d + rho * phi * k + Math.sqrt(1.0d + 2 * rho * phi * k + phi * k * phi * k)); return Math.sqrt(w / timeToExpiry); } private  SsviVolatilityFunction(); @Override double volatility(double forward, double strike, double timeToExpiry, SsviFormulaData data); @Override ValueDerivatives volatilityAdjoint(double forward, double strike, double timeToExpiry, SsviFormulaData data); @Override double volatilityAdjoint2(double forward, double strike, double timeToExpiry,
      SsviFormulaData data, double[] volatilityD, double[][] volatilityD2); static TypedMetaBean<SsviVolatilityFunction> meta(); @Override TypedMetaBean<SsviVolatilityFunction> metaBean(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static final SsviVolatilityFunction DEFAULT; static final double MIN_TIME_TO_EXPIRY; }### Answer:
@Test public void volatility() { double theta = VOL_ATM * VOL_ATM * TIME_EXP; double phi = ETA / Math.sqrt(theta); for (int i = 0; i < N; i++) { double k = Math.log(STRIKES[i] / FORWARD); double w = 0.5 * theta * (1.0d + RHO * phi * k + Math.sqrt(Math.pow(phi * k + RHO, 2) + (1.0d - RHO * RHO))); double sigmaExpected = Math.sqrt(w / TIME_EXP); double sigmaComputed = SSVI_FUNCTION.volatility(FORWARD, STRIKES[i], TIME_EXP, DATA); assertThat(sigmaExpected).isCloseTo(sigmaComputed, offset(TOLERANCE_VOL)); } }
@Test public void test_small_time() { assertThatIllegalArgumentException() .isThrownBy(() -> SSVI_FUNCTION.volatility(FORWARD, STRIKES[0], 0.0, DATA)); }