final int nbTest = strike.length;
final double shift = 0.00001;
for (int looptest = 0; looptest < nbTest; looptest++) {
final double vol = SMILE_TERM.getVolatility(timeToExpiration[looptest], strike[looptest], forward);
final double[][] bucketTest = new double[TIME_TO_EXPIRY.length][2 * DELTA.length + 1];
final VolatilityAndBucketedSensitivities volComputed = SMILE_TERM.getVolatilityAndSensitivities(timeToExpiration[looptest], strike[looptest], forward);
final double[][] bucketSensi = volComputed.getBucketedSensitivities();
assertEquals("Smile by delta term structure: volatility adjoint", vol, volComputed.getVolatility(), 1.0E-10);
final SmileDeltaParameters[] volData = new SmileDeltaParameters[TIME_TO_EXPIRY.length];
final double[] volBumped = new double[2 * DELTA.length + 1];
for (int loopexp = 0; loopexp < TIME_TO_EXPIRY.length; loopexp++) {
for (int loopsmile = 0; loopsmile < 2 * DELTA.length + 1; loopsmile++) {
System.arraycopy(SMILE_TERM.getVolatilityTerm(), 0, volData, 0, TIME_TO_EXPIRY.length);
System.arraycopy(SMILE_TERM.getVolatilityTerm()[loopexp].getVolatility(), 0, volBumped, 0, 2 * DELTA.length + 1);
volBumped[loopsmile] += shift;
volData[loopexp] = new SmileDeltaParameters(TIME_TO_EXPIRY[loopexp], DELTA, volBumped);
final SmileDeltaTermStructureParametersStrikeInterpolation smileTermBumped = new SmileDeltaTermStructureParametersStrikeInterpolation(volData, INTERPOLATOR_STRIKE);
bucketTest[loopexp][loopsmile] = (smileTermBumped.getVolatility(timeToExpiration[looptest], strike[looptest], forward) - volComputed.getVolatility()) / shift;
// FIXME: the strike sensitivity to volatility is missing. To be corrected when [PLAT-1396] is fixed.
assertEquals("Smile by delta term structure: (test: " + looptest + ") volatility bucket sensitivity " + loopexp + " - " + loopsmile, bucketTest[loopexp][loopsmile],
bucketSensi[loopexp][loopsmile], tolerance[looptest]);
}
}