@Test
public void testParseUriPathPatterns() {

    Map<String, String> map = HttpUtils.parseUriPattern("/cats/{id}", "/cats/1");
    Match.equals(map, "{ id: '1' }");
    map = HttpUtils.parseUriPattern("/cats/{id}/", "/cats/1"); // trailing slash
    Match.equals(map, "{ id: '1' }");
    map = HttpUtils.parseUriPattern("/cats/{id}", "/cats/1/"); // trailing slash
    Match.equals(map, "{ id: '1' }");
    map = HttpUtils.parseUriPattern("/cats/{id}", "/foo/bar");
    Match.equals(map, null);
    map = HttpUtils.parseUriPattern("/cats", "/cats/1"); // exact match
    Match.equals(map, null);
    map = HttpUtils.parseUriPattern("/{path}/{id}", "/cats/1");
    Match.equals(map, "{ path: 'cats', id: '1' }");
    map = HttpUtils.parseUriPattern("/cats/{id}/foo", "/cats/1/foo");
    Match.equals(map, "{ id: '1' }");
    map = HttpUtils.parseUriPattern("/api/{img}", "/api/billie.jpg");
    Match.equals(map, "{ img: 'billie.jpg' }");
    map = HttpUtils.parseUriPattern("/{greedyPath:.+}", "/cats/1");
    Match.equals(map, "{ greedyPath: 'cats/1' }");
    map = HttpUtils.parseUriPattern("/cats/v{partialPath}x", "/cats/v1x");
    Match.equals(map, "{ partialPath: '1' }");
    map = HttpUtils.parseUriPattern("/cats/{duplicate}/{duplicate}", "/cats/v1/1043");
    Match.equals(map, "{ duplicate: 'v1', 'duplicate@2': '1043' }");
    map = HttpUtils.parseUriPattern("/cats/{}/{}", "/cats/v1/1043");
    Match.equals(map, "{ ignored: 'v1', 'ignored@2': '1043' }");
}