@Test
  public void shouldReturnEmptyMapForEmptyProperties() throws Exception {
    // Given
    String node = HTTP.POST(server().baseUri().resolve("db/data/node").toString()).location();
    String rel =
        HTTP.POST(node + "/relationships", quotedJson("{'to':'" + node + "', " + "'type':'LOVES'}"))
            .location();

    // When
    HTTP.Response res = HTTP.GET(rel + "/properties");

    // Then
    MatcherAssert.assertThat(res.rawContent(), equalTo("{ }"));
  }
Пример #2
0
  @Test
  public void testFindWithin() throws Exception {
    Nearby param = new Nearby();
    param.setLongitude(79.8547);
    param.setLatitude(6.8939);
    param.setDistance(1);
    HTTP.Response response =
        HTTP.POST(server.httpURI().resolve("/contra/location/findwithin").toString(), param);

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

    Gson gson = new Gson();
    Message<List<Location>> message =
        gson.fromJson(response.rawContent(), new TypeToken<Message<List<Location>>>() {}.getType());
    List<Location> locations = message.getEntity();
    // Check the status.
    assertEquals("Exact locations are not found.", 3, locations.size());

    String[] expected = {"Majestic City", "Unity Plaza"};
    String[] actual = {locations.get(0).getName(), locations.get(1).getName()};
    assertArrayEquals("Expected locations are not found.", expected, actual);
  }