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 testExtractionWithTemplateVariables()
  {
    final String[] components1 = URIParamUtils.extractPathComponentsFromUriTemplate("foo");
    Assert.assertEquals(components1.length, 1);
    Assert.assertEquals(components1[0], "foo");

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

    final String[] components3 = URIParamUtils.extractPathComponentsFromUriTemplate("foo/{keys1}/bar/{keys2}/baz");
    Assert.assertEquals(components3.length, 3);
    Assert.assertEquals(components3[0], "foo");
    Assert.assertEquals(components3[1], "bar");
    Assert.assertEquals(components3[2], "baz");

    final String[] components4 = URIParamUtils.extractPathComponentsFromUriTemplate("foo/{keys1}/{keys2}/bar");
    Assert.assertEquals(components4.length, 2);
    Assert.assertEquals(components4[0], "foo");
    Assert.assertEquals(components4[1], "bar");
  }