### Question:
PatternMountedMapper extends MountedMapper { protected static String removePatternsFromPlaceholders(String path) { if(null == path) { return null; } StringBuilder result = new StringBuilder(); String [] segments = path.split("/"); for(int i=0; i<segments.length; i++) { String seg = segments[i]; result.append(seg.replaceAll("^(\\$\\{[^:]+):.+\\}$", "$1}")); if(i < segments.length-1 || path.endsWith("/")) { result.append("/"); } } return result.toString(); } PatternMountedMapper(String mountPath, Class<? extends IRequestablePage> pageClass);  PatternMountedMapper(String mountPath,
                                ClassProvider<? extends IRequestablePage> pageClassProvider);  PatternMountedMapper(String mountPath,
                                Class<? extends IRequestablePage> pageClass,
                                IPageParametersEncoder pageParametersEncoder);  PatternMountedMapper(String mountPath,
                                ClassProvider<? extends IRequestablePage> pageClassProvider,
                                IPageParametersEncoder pageParametersEncoder); PatternMountedMapper setExact(boolean exact);  }### Answer:
@Test public void testRemovePatternsFromPlaceholders() { final String[][] inputAndExpectedOutput = new String[][] { new String[] { null, null }, new String[] { "/foo", "/foo" }, new String[] { "/foo/", "/foo/" }, new String[] { "foo", "foo" }, new String[] { "foo/", "foo/" }, new String[] { "foo/bar", "foo/bar" }, new String[] { "foo/bar/", "foo/bar/" }, new String[] { "${foo}", "${foo}" }, new String[] { "${foo}/bar", "${foo}/bar" }, new String[] { "${foo}/bar/${baz}", "${foo}/bar/${baz}" }, new String[] { "products/${productId:\\d+}/${slug:.*}", "products/${productId}/${slug}" }, new String[] { "packages/${trackingCode:1Z[0-9A-Za-z]{16}}/${slug}", "packages/${trackingCode}/${slug}" } }; for(String[] pair : inputAndExpectedOutput) { String input = pair[0]; String expected = pair[1]; Assert.assertEquals( "Failed input: " + input, expected, PatternMountedMapper.removePatternsFromPlaceholders(input)); } }