### Question:
URIMapper { public String map(String uri) { for (Mapping mapping : mappings) { Matcher matcher = mapping.from.matcher(uri); if (matcher.matches()) { String result = mapping.to; log.debug("uri: {}, mapping to: {}", uri, result); for (int i = 1; i <= matcher.groupCount(); i++) { log.debug("group {}: {}", i, matcher.group(i)); result = result.replaceAll("\\$\\{" + i + "\\}", matcher.group(i)); } log.debug("result: {}", result); return result; } } return null; } @Inject  URIMapper(@Named("uri-mappings") File mappingsFile); String map(String uri);  }### Answer:
@Test public void testApi() { try { String expected = "http: String actual = null; actual = uriMapper.map("api/account"); Assert.assertEquals(expected, actual); } catch (Exception e) { fail(e.getMessage()); } }
@Test public void testDn() { try { String uri = "x/y/z"; String expected = "http: String actual = uriMapper.map(uri); Assert.assertEquals(expected, actual); } catch (Exception e) { fail(e.getMessage()); } }