public static ObjectNode convertFromGHResponse(GHResponse ghResponse, TranslationMap translationMap, Locale locale,
            DistanceConfig distanceConfig) {
        ObjectNode json = JsonNodeFactory.instance.objectNode();

        if (ghResponse.hasErrors())
            throw new IllegalStateException(
                    "If the response has errors, you should use the method NavigateResponseConverter#convertFromGHResponseError");

        PointList waypoints = ghResponse.getBest().getWaypoints();

        final ArrayNode routesJson = json.putArray("routes");

        List<ResponsePath> paths = ghResponse.getAll();

        for (int i = 0; i < paths.size(); i++) {
            ResponsePath path = paths.get(i);
            ObjectNode pathJson = routesJson.addObject();

            putRouteInformation(pathJson, path, i, translationMap, locale, distanceConfig);
        }

        final ArrayNode waypointsJson = json.putArray("waypoints");
        for (int i = 0; i < waypoints.size(); i++) {
            ObjectNode waypointJson = waypointsJson.addObject();
            // TODO get names
            waypointJson.put("name", "");
            putLocation(waypoints.getLat(i), waypoints.getLon(i), waypointJson);
        }

        json.put("code", "Ok");
        // TODO: Maybe we need a different format... uuid: "cji4ja4f8004o6xrsta8w4p4h"
        json.put("uuid", UUID.randomUUID().toString().replaceAll("-", ""));

        return json;
    }
@Test
    public void arriveGeometryTest() {

        GHResponse rsp = hopper.route(new GHRequest(42.554851, 1.536198, 42.510071, 1.548128).setProfile(profile));

        ObjectNode json = NavigateResponseConverter.convertFromGHResponse(rsp, trMap, Locale.ENGLISH, distanceConfig);

        JsonNode steps = json.get("routes").get(0).get("legs").get(0).get("steps");

        // Step 17 is the last before arrival
        JsonNode step = steps.get(17);

        PointList expectedArrivePointList = rsp.getBest().getInstructions().get(17).getPoints().clone(false);
        PointList ghArrive = rsp.getBest().getInstructions().get(18).getPoints();
        // We expect that the Mapbox compatible response builds the geometry to the
        // arrival coordinate
        expectedArrivePointList.add(ghArrive);
        String encodedExpected = ResponsePathSerializer.encodePolyline(expectedArrivePointList, false, 1e6);

        assertEquals(encodedExpected, step.get("geometry").asText());
    }