MarkovChainApprox { public double[] getMoments(final double expiry) { final double m1 = getM1(expiry); final double m2 = getM2(expiry); final double m3 = getM3(expiry); return new double[] {m1, m2, m3}; } MarkovChainApprox(final double vol1, final double vol2, final double lambda12, final double lambda21, final double probState1, final double expiry); double price(final double forward, final double df, final double strike); double priceCEV(final double forward, final double df, final double strike, final double beta); double[] getMoments(final double expiry);  }
@Test public void momentTest() { final double[] res1 = CHAIN.getMoments(T, SIMS); final double[] res2 = CHAIN_APPROX.getMoments(T); Validate.isTrue(res1.length == res2.length); for (int i = 0; i < res1.length; i++) { assertEquals(res1[i], res2[i], 5e-3 * res1[i]); } }