### Question:
PathSpecification { public boolean matches(String path) { boolean res = false; int len = prefix.length(); if (path.length() >= len) { String matching = path.substring(0, len); if (matching.equals(prefix)) { res = true; } } return res; } PathSpecification(); static PathSpecification fromSpecString(String pathSpec); boolean matches(String path); Map<String, String> parseParams(String path); public String prefix; public List<String> paramNames; public String pathSpec; }### Answer:
@Test public void testMatches() { String pathSpec = "/test/one/{param1}/{param2}"; PathSpecification ps = PathSpecification.fromSpecString(pathSpec); boolean result1 = ps.matches("/test/one/1"); assertEquals(true,result1); boolean result2 = ps.matches("/test/one/1/2/3"); assertEquals(true,result2); }