### Question:
DistanceTravelledCalculator { static List<Double> makeConstantDifference(List<Double> list) { List<Double> result = new ArrayList<>(); double diff = list.get(1) - list.get(0); Double previous = null; for (int i = 0; i < list.size(); i++) { double next; if (previous == null) { next = list.get(0); } else { next = previous + diff; } result.add(next); previous = next; } return result; } DistanceTravelledCalculator(Options options, DistanceCalculationMetrics metrics); Observable<CellAndDistance> calculateDistanceByCellFromFiles(Observable<File> files); DistanceCalculationMetrics getMetrics(); static Observable<CellValue> calculateDensityByCellFromFiles(Options options,
            Observable<File> files, int horizontal, int vertical,
            DistanceCalculationMetrics metrics); static CalculationResult calculateTrafficDensity(Options options,
            Observable<File> files); static CalculationResult calculateTrafficDensity(Options options, Observable<File> files,
            int horizontal, int vertical); static void saveCalculationResultAsText(Options options,
            CalculationResult calculationResult, String filename); static void saveCalculationResultAsNetcdf(Options options,
            CalculationResult calculationResult, String filename); static Observable<Options> partition(final Options options, final int horizontal,
            final int vertical);  }### Answer:
@Test public void testConstantDifference() { List<Double> list = DistanceTravelledCalculator .makeConstantDifference(Arrays.asList(1.0, 2.0, 3.1, 4.2)); assertEquals(4, list.size()); double precision = 0.000001; assertEquals(1.0, list.get(0), precision); assertEquals(2.0, list.get(1), precision); assertEquals(3.0, list.get(2), precision); assertEquals(4.0, list.get(3), precision); }