Пример #1
0
  @Test
  public void testCreateLocation() throws Exception {
    Time time = Time.of(2015, 12, 24, 9, 1, 0);
    UserLocation mc =
        TestUtility.createUserLocation(
            "+94770780210", "CDC47124648058A", 98.0f, "Home", 79.857488, 6.8781381, time);

    HTTP.Response response =
        HTTP.POST(server.httpURI().resolve("/contra/location/create").toString(), mc);

    // Check the status.
    assertEquals("Error in request.", HttpURLConnection.HTTP_OK, response.status());

    // Do not use the exact location for withinDistance
    Result result =
        server
            .graph()
            .execute(
                "START n = node:location_layer('withinDistance:[6.8781381, 79.857487, 0.1]') RETURN n.name as name");

    Map<String, Object> map = result.next();

    assertEquals("Location is not created.", "Home", map.get("name"));
  }