@Test public void testGetProtocol( ) { String protocol = ProxyHelper.getProtocol( SOURCE_URL ); assertEquals( "protocol", "https", protocol ); }
static String getProtocol( String url ) { log.debug( "getProtocol( url = '{}' )", url ); String protocol = DEFAULT_PROTOCOL; try { URL u = new URL( url ); protocol = u.getProtocol( ); } catch ( MalformedURLException e ) { String message = String.format( "Failed to parse URL '%s'", url ); log.warn( message, e ); } log.debug( "getProtocol( ): protocol = '{}'", protocol ); return protocol; }
ProxyHelper { static String getProtocol( String url ) { log.debug( "getProtocol( url = '{}' )", url ); String protocol = DEFAULT_PROTOCOL; try { URL u = new URL( url ); protocol = u.getProtocol( ); } catch ( MalformedURLException e ) { String message = String.format( "Failed to parse URL '%s'", url ); log.warn( message, e ); } log.debug( "getProtocol( ): protocol = '{}'", protocol ); return protocol; } }
ProxyHelper { static String getProtocol( String url ) { log.debug( "getProtocol( url = '{}' )", url ); String protocol = DEFAULT_PROTOCOL; try { URL u = new URL( url ); protocol = u.getProtocol( ); } catch ( MalformedURLException e ) { String message = String.format( "Failed to parse URL '%s'", url ); log.warn( message, e ); } log.debug( "getProtocol( ): protocol = '{}'", protocol ); return protocol; } private  ProxyHelper(  ); }
ProxyHelper { static String getProtocol( String url ) { log.debug( "getProtocol( url = '{}' )", url ); String protocol = DEFAULT_PROTOCOL; try { URL u = new URL( url ); protocol = u.getProtocol( ); } catch ( MalformedURLException e ) { String message = String.format( "Failed to parse URL '%s'", url ); log.warn( message, e ); } log.debug( "getProtocol( ): protocol = '{}'", protocol ); return protocol; } private  ProxyHelper(  ); static Proxy getProxy( String url ); }
ProxyHelper { static String getProtocol( String url ) { log.debug( "getProtocol( url = '{}' )", url ); String protocol = DEFAULT_PROTOCOL; try { URL u = new URL( url ); protocol = u.getProtocol( ); } catch ( MalformedURLException e ) { String message = String.format( "Failed to parse URL '%s'", url ); log.warn( message, e ); } log.debug( "getProtocol( ): protocol = '{}'", protocol ); return protocol; } private  ProxyHelper(  ); static Proxy getProxy( String url ); static final String DEFAULT_PROTOCOL; }