public static Double interpolateCourse(Double c1, Double c2, double fraction) {

        if (c1 == null || c2 == null) {
            return null;
        }

        checkArgument(VALID_COURSE_RANGE.contains(c1), "The 1st course: " + c1 + " is not in range");
        checkArgument(VALID_COURSE_RANGE.contains(c2), "The 2nd course: " + c2 + " is not in range");
        checkArgument(VALID_FRACTION_RANGE.contains(fraction), "The fraction: " + fraction + " is not in range");

        double angleDelta = Spherical.angleDifference(c2, c1);
        Double course = c1 + interpolate(0.0, angleDelta, fraction);
        return Spherical.mod(course, 360.0d);
    }
@Test
    public void testInterpolateCourse() {
        /*
         * Confirm interpolateCourse work (espiecially when course goes from values like 354 to 4)
         */
        double TOL = 0.001;

        assertEquals(
            5.0,
            interpolateCourse(5.0, 10.0, 0.0),
            TOL
        );

        assertEquals(
            10.0,
            interpolateCourse(5.0, 10.0, 1.0),
            TOL
        );

        assertEquals(
            5.0,
            interpolateCourse(5.0, 355.0, 0.0),
            TOL
        );

        assertEquals(
            355.0,
            interpolateCourse(5.0, 355.0, 1.0),
            TOL
        );

        assertEquals(
            0.0,
            interpolateCourse(5.0, 355.0, 0.5),
            TOL
        );

        assertEquals(
            350.0,
            interpolateCourse(330.0, 20.0, 0.4),
            TOL
        );

        assertEquals(
            350.0,
            interpolateCourse(20.0, 330.0, 0.6),
            TOL
        );
    }