### Question:
MatrixRequestHandler { protected static Coordinate[] convertLocations(List<List<Double>> locations, int numberOfRoutes) throws ParameterValueException, ServerLimitExceededException { if (locations == null || locations.size() < 2) throw new ParameterValueException(MatrixErrorCodes.INVALID_PARAMETER_VALUE, MatrixRequest.PARAM_LOCATIONS); int maximumNumberOfRoutes = MatrixServiceSettings.getMaximumRoutes(false); if (numberOfRoutes > maximumNumberOfRoutes) throw new ServerLimitExceededException(MatrixErrorCodes.PARAMETER_VALUE_EXCEEDS_MAXIMUM, "Only a total of " + maximumNumberOfRoutes + " routes are allowed."); ArrayList<Coordinate> locationCoordinates = new ArrayList<>(); for (List<Double> coordinate : locations) { locationCoordinates.add(convertSingleLocationCoordinate(coordinate)); } try { return locationCoordinates.toArray(new Coordinate[locations.size()]); } catch (NumberFormatException | ArrayStoreException | NullPointerException ex) { throw new ParameterValueException(MatrixErrorCodes.INVALID_PARAMETER_VALUE, MatrixRequest.PARAM_LOCATIONS); } } private  MatrixRequestHandler(); static MatrixResult generateMatrixFromRequest(MatrixRequest request); static org.heigit.ors.matrix.MatrixRequest convertMatrixRequest(MatrixRequest request); static int convertMetrics(MatrixRequestEnums.Metrics[] metrics);  }### Answer:
@Test(expected = ParameterValueException.class) public void notEnoughLocationsTest() throws ParameterValueException, ServerLimitExceededException { MatrixRequestHandler.convertLocations(minimalLocations, 5); }
@Test(expected = ServerLimitExceededException.class) public void maximumExceedingLocationsTest() throws ParameterValueException, ServerLimitExceededException { MatrixRequestHandler.convertLocations(listOfBareCoordinatesList, maximumRoutes); }
@Test public void convertLocationsTest() throws ParameterValueException, ServerLimitExceededException { Coordinate[] coordinates = MatrixRequestHandler.convertLocations(listOfBareCoordinatesList, 3); Assert.assertEquals(8.681495, coordinates[0].x, 0); Assert.assertEquals(49.41461, coordinates[0].y, 0); Assert.assertEquals(Double.NaN, coordinates[0].z, 0); Assert.assertEquals(8.686507, coordinates[1].x, 0); Assert.assertEquals(49.41943, coordinates[1].y, 0); Assert.assertEquals(Double.NaN, coordinates[1].z, 0); Assert.assertEquals(8.687872, coordinates[2].x, 0); Assert.assertEquals(49.420318, coordinates[2].y, 0); Assert.assertEquals(Double.NaN, coordinates[2].z, 0); }