public static String[] extractPathComponentsFromUriTemplate(String uriTemplate)
  {
    final String normalizedUriTemplate = NORMALIZED_URI_PATTERN.matcher(uriTemplate).replaceAll("");
    final UriTemplate template = new UriTemplate(normalizedUriTemplate);
    final String uri = template.createURI(_EMPTY_STRING_ARRAY);
    return URI_SEPARATOR_PATTERN.split(uri);
  }
@Test
  public void testExtractionWithSlashes()
  {
    final String[] components1 = URIParamUtils.extractPathComponentsFromUriTemplate("/foo");
    Assert.assertEquals(components1.length, 1);
    Assert.assertEquals(components1[0], "foo");

    final String[] components2 = URIParamUtils.extractPathComponentsFromUriTemplate("foo/");
    Assert.assertEquals(components2.length, 1);
    Assert.assertEquals(components2[0], "foo");
  }