Utils { public static double computeSeasonalFactor(double daysSince2000, double sunEarthDistanceSquare) { final double a = 149597870.0 * 1000.0; final double e = 0.017; final double daysToPerihelionIn2000 = 3.0 + 5.0 / 24.0; final double daysOfYear = 365.25; final double theta = 2 * Math.PI * ((daysSince2000 - daysToPerihelionIn2000) / daysOfYear); final double r = a * (1.0 - e * e) / (1.0 + e * Math.cos(theta)); return r * r / sunEarthDistanceSquare; } private  Utils(); static double computeSeasonalFactor(double daysSince2000, double sunEarthDistanceSquare); static boolean isProductRR(Product product); static boolean isProductFR(Product product);  }
@Test public void testSeasonalFactorComputation() { double meanEarthSunDist = 149.60e+06 * 1000; final double sunEarthDistanceSquare = meanEarthSunDist * meanEarthSunDist; final double vStart = Utils.computeSeasonalFactor(0, sunEarthDistanceSquare); assertEquals(1, vStart, 0.05); assertTrue(vStart < 1.0); final double vMid = Utils.computeSeasonalFactor(0.5 * 365, sunEarthDistanceSquare); assertEquals(1, vMid, 0.05); assertTrue(vMid > 1.0); final double vEnd = Utils.computeSeasonalFactor(365, sunEarthDistanceSquare); assertEquals(1, vEnd, 0.05); assertTrue(vEnd < 1.0); }