@Override
    public double distanceBtw(Point p1, Point p2) {

        numCalls++;

        confirmRequiredDataIsPresent(p1);
        confirmRequiredDataIsPresent(p2);

        Duration timeDelta = Duration.between(p1.time(), p2.time()); //can be positive of negative
        timeDelta = timeDelta.abs();

        Double horizontalDistanceInNm = p1.distanceInNmTo(p2);

        Double horizontalDistanceInFeet = horizontalDistanceInNm * Spherical.feetPerNM();
        Double altitudeDifferenceInFeet = Math.abs(p1.altitude().inFeet() - p2.altitude().inFeet());

        Double distInFeet = hypot(horizontalDistanceInFeet, altitudeDifferenceInFeet);

        return (distanceCoef * distInFeet) + (timeCoef * timeDelta.toMillis());
    }
@Test
    public void testTimeComputation() {

        PointDistanceMetric metric = new PointDistanceMetric(1.0, 1.0);
        PointDistanceMetric metric2 = new PointDistanceMetric(2.0, 1.0);

        Instant time1 = Instant.EPOCH;
        Instant time2 = time1.plusSeconds(1L);

        Point p1 = new PointBuilder()
            .latLong(0.0, 0.0)
            .altitude(Distance.ofFeet(0.0))
            .time(time1)
            .build();

        Point p2 = new PointBuilder()
            .latLong(0.0, 0.0)
            .altitude(Distance.ofFeet(0.0))
            .time(time2)
            .build();

        double TOLERANCE = 0.00001;

        assertEquals(
            1000.0, metric.distanceBtw(p1, p2), TOLERANCE,
            "A 1 second time difference should produce a distance of 1000.0 (when coef = 1.0)"
        );

        assertEquals(
            1000.0, metric.distanceBtw(p2, p1), TOLERANCE,
            "Switching the points shouldn't change the distance measurement"
        );

        assertEquals(
            2000.0, metric2.distanceBtw(p1, p2), TOLERANCE,
            "A 1 second time difference should produce a distance of 2000.0 (when coef = 2.0)"
        );

        assertEquals(
            2000.0, metric2.distanceBtw(p2, p1), TOLERANCE,
            "Switching the points shouldn't change the distance measurement"
        );
    }