示例#1
0
  @Test
  public void shouldGetTemplateParams() throws Exception {
    assertThat(restResource.getDefaultParams(), is(anEmptyArray()));

    restResource.setPath("/{id}/test");
    assertThat(restResource.getDefaultParams(), is(anEmptyArray()));
    assertThat(restResource.getFullPath(), is("/{id}/test"));

    RestResource subResource = restResource.addNewChildResource("Child", "{test}/test");
    assertThat(subResource.getFullPath(), is("/{id}/test/{test}/test"));
  }
示例#2
0
  @Test
  public void shouldIgnoreMatrixParamsWithoutValueOnPath() throws Exception {
    String matrixParameterString = ";Param2=1;address=";
    restResource.setPath("/maps/api/geocode/xml" + matrixParameterString);

    assertThat(restResource.getFullPath(), not(containsString(matrixParameterString)));

    String childResourceParameterString = ";ver=";
    RestResource childResource =
        restResource.addNewChildResource(
            "Child", "{test}/test/version" + childResourceParameterString);
    assertThat(childResource.getPath(), not(containsString(childResourceParameterString)));

    assertThat(childResource.getFullPath(), not(containsString(matrixParameterString)));
    assertThat(childResource.getFullPath(), not(containsString(childResourceParameterString)));
  }