### Question:
ProtocolSupport { public static String getRequestUri(final HttpRequest request) { final URIAuthority authority = request.getAuthority(); if (authority != null) { final StringBuilder buf = new StringBuilder(); final String scheme = request.getScheme(); buf.append(scheme != null ? scheme : URIScheme.HTTP.id); buf.append(": if (authority.getUserInfo() != null) { buf.append(authority.getUserInfo()); buf.append("@"); } buf.append(authority.getHostName()); if (authority.getPort() != -1) { buf.append(":"); buf.append(authority.getPort()); } final String path = request.getPath(); if (path == null || !path.startsWith("/")) { buf.append("/"); } if (path != null) { buf.append(path); } return buf.toString(); } else { return request.getPath(); } }  static String getRequestUri(final HttpRequest request);  }### Answer:
@Test public void testGetRequestUri() { final HttpRequest request = new BasicHttpRequest(Method.GET, ""); Assert.assertThat(ProtocolSupport.getRequestUri(request), CoreMatchers.equalTo("/")); request.setAuthority(new URIAuthority("testUser", "localhost", 8080)); Assert.assertThat(ProtocolSupport.getRequestUri(request), CoreMatchers.equalTo("http: request.setScheme("https"); Assert.assertThat(ProtocolSupport.getRequestUri(request), CoreMatchers.equalTo("https: request.setPath("blah"); Assert.assertThat(ProtocolSupport.getRequestUri(request), CoreMatchers.equalTo("https: request.setPath("/blah/blah"); Assert.assertThat(ProtocolSupport.getRequestUri(request), CoreMatchers.equalTo("https: }