@Test public void shouldDropUrlStringFromUrl(){ String url = "http: String actual = OAuthsV1.constructRequestURL(url); assertEquals("http: }
static String constructRequestURL(String url) { int index = url.indexOf('?'); String retVal = url; if (-1 != index) { retVal = retVal.substring(0, index); } int slashIndex = retVal.indexOf('/', AFTER_PROTOCOL_INDEX); String baseURL = retVal.substring(0, slashIndex).toLowerCase(); int colonIndex = baseURL.indexOf(':', AFTER_PROTOCOL_INDEX); if (-1 != colonIndex) { if (baseURL.startsWith("http: baseURL = baseURL.substring(0, colonIndex); } else if (baseURL.startsWith("https: baseURL = baseURL.substring(0, colonIndex); } } return baseURL + retVal.substring(slashIndex); }
OAuthsV1 { static String constructRequestURL(String url) { int index = url.indexOf('?'); String retVal = url; if (-1 != index) { retVal = retVal.substring(0, index); } int slashIndex = retVal.indexOf('/', AFTER_PROTOCOL_INDEX); String baseURL = retVal.substring(0, slashIndex).toLowerCase(); int colonIndex = baseURL.indexOf(':', AFTER_PROTOCOL_INDEX); if (-1 != colonIndex) { if (baseURL.startsWith("http: baseURL = baseURL.substring(0, colonIndex); } else if (baseURL.startsWith("https: baseURL = baseURL.substring(0, colonIndex); } } return baseURL + retVal.substring(slashIndex); } }
OAuthsV1 { static String constructRequestURL(String url) { int index = url.indexOf('?'); String retVal = url; if (-1 != index) { retVal = retVal.substring(0, index); } int slashIndex = retVal.indexOf('/', AFTER_PROTOCOL_INDEX); String baseURL = retVal.substring(0, slashIndex).toLowerCase(); int colonIndex = baseURL.indexOf(':', AFTER_PROTOCOL_INDEX); if (-1 != colonIndex) { if (baseURL.startsWith("http: baseURL = baseURL.substring(0, colonIndex); } else if (baseURL.startsWith("https: baseURL = baseURL.substring(0, colonIndex); } } return baseURL + retVal.substring(slashIndex); } private  OAuthsV1(); }
OAuthsV1 { static String constructRequestURL(String url) { int index = url.indexOf('?'); String retVal = url; if (-1 != index) { retVal = retVal.substring(0, index); } int slashIndex = retVal.indexOf('/', AFTER_PROTOCOL_INDEX); String baseURL = retVal.substring(0, slashIndex).toLowerCase(); int colonIndex = baseURL.indexOf(':', AFTER_PROTOCOL_INDEX); if (-1 != colonIndex) { if (baseURL.startsWith("http: baseURL = baseURL.substring(0, colonIndex); } else if (baseURL.startsWith("https: baseURL = baseURL.substring(0, colonIndex); } } return baseURL + retVal.substring(slashIndex); } private  OAuthsV1();  }
OAuthsV1 { static String constructRequestURL(String url) { int index = url.indexOf('?'); String retVal = url; if (-1 != index) { retVal = retVal.substring(0, index); } int slashIndex = retVal.indexOf('/', AFTER_PROTOCOL_INDEX); String baseURL = retVal.substring(0, slashIndex).toLowerCase(); int colonIndex = baseURL.indexOf(':', AFTER_PROTOCOL_INDEX); if (-1 != colonIndex) { if (baseURL.startsWith("http: baseURL = baseURL.substring(0, colonIndex); } else if (baseURL.startsWith("https: baseURL = baseURL.substring(0, colonIndex); } } return baseURL + retVal.substring(slashIndex); } private  OAuthsV1();   }