SignatureBaseString { public String normalizeRequestUrl() throws URISyntaxException { URI uri = new URI(request.getRequestUrl()); String scheme = uri.getScheme().toLowerCase(); String authority = uri.getAuthority().toLowerCase(); boolean dropPort = (scheme.equals("http") && uri.getPort() == 80) || (scheme.equals("https") && uri.getPort() == 443); if (dropPort) { int index = authority.lastIndexOf(":"); if (index >= 0) { authority = authority.substring(0, index); } } String path = uri.getRawPath(); if (path == null || path.length() <= 0) { path = "/"; } return scheme + ": } SignatureBaseString(HttpRequest request, HttpParameters requestParameters); String generate(); String normalizeRequestUrl(); String normalizeRequestParameters();  }
@Test public void shouldNormalizeRequestUrl() throws Exception { when(httpGetMock.getRequestUrl()) .thenReturn("HTTP: assertEquals("http: OAUTH_PARAMS).normalizeRequestUrl()); when(httpGetMock.getRequestUrl()).thenReturn("http: assertEquals("http: .normalizeRequestUrl()); when(httpGetMock.getRequestUrl()).thenReturn("https: assertEquals("https: .normalizeRequestUrl()); }