### Question:
Utilities { public static String getHost(String uri) { if (StringUtils.isBlank(uri)) return null; int start = 0, end = uri.length(); Matcher matcher = SCHEME_PATTERN.matcher(uri); if (matcher.find()) { start = matcher.end(); } matcher = NON_HOSTNAME_CHARACTERS.matcher(uri).region(start, uri.length()); if (matcher.find()) { end = matcher.start(); } return (end > start) ? uri.substring(start, end) : null; }  static byte[] parseBase64(String encoded, String paramName); static boolean isValidDirectoryName(String name); static boolean isValidRestrictedDirectoryName(String name); static Object createAnyInstance(Class<?> confClass,
                                           String className, RequestContext metaData); static Object createAnyInstance(String className); static void byteArrayToOctalString(byte[] bytes, StringBuilder sb); static String maskNonPrintables(String input); static FragmentMetadata parseFragmentMetadata(RequestContext context); static boolean aggregateOptimizationsSupported(RequestContext requestContext); static boolean implementsInterface(String className, Class<?> iface); static boolean isFragmenterCacheEnabled(); static String absoluteDataPath(String dataSource); static boolean isSecurityEnabled(Configuration configuration); static String rightTrimWhiteSpace(String s); static String getHost(String uri); static final Pattern SCHEME_PATTERN; static final Pattern NON_HOSTNAME_CHARACTERS; }### Answer:
@Test public void testGetHost() { assertNull(Utilities.getHost(null)); assertNull(Utilities.getHost("")); assertNull(Utilities.getHost(" ")); assertNull(Utilities.getHost(":")); assertNull(Utilities.getHost("#")); assertNull(Utilities.getHost("/")); assertNull(Utilities.getHost("/file/path/abc")); assertEquals("www.google.com", Utilities.getHost("https: assertEquals("www.google.com", Utilities.getHost("http: assertEquals("www.blog.classroom.me.uk", Utilities.getHost("http: assertEquals("www.youtube.com", Utilities.getHost("http: assertEquals("www.youtube.com", Utilities.getHost("https: assertEquals("www.youtube.com", Utilities.getHost("www.youtube.com/watch?v=ClkQA2Lb_iE")); assertEquals("ftp.websitename.com", Utilities.getHost("ftps: assertEquals("websitename.com", Utilities.getHost("websitename.com:1234/dir/file.txt")); assertEquals("websitename.com", Utilities.getHost("ftps: assertEquals("example.com", Utilities.getHost("example.com?param=value")); assertEquals("facebook.github.io", Utilities.getHost("https: assertEquals("youtube.com", Utilities.getHost(" assertEquals("localhost", Utilities.getHost("http: assertEquals("127.0.0.1", Utilities.getHost("hdfs: assertEquals("my-bucket", Utilities.getHost("s3a: assertEquals("foo", Utilities.getHost("s3: assertEquals("foo.azuredatalakestore.net", Utilities.getHost("adl: assertEquals("foo", Utilities.getHost("xyz: assertEquals("0.0.0.0", Utilities.getHost("xyz: assertEquals("abc", Utilities.getHost("xyz: assertNull(Utilities.getHost("file: assertEquals("0.0.0.0", Utilities.getHost("hdfs: assertEquals("abc", Utilities.getHost("hdfs: assertEquals("0.0.0.0", Utilities.getHost("hdfs: assertEquals("0.0.0.0", Utilities.getHost("hdfs: assertEquals("0.0.0.0", Utilities.getHost("hdfs: assertEquals("0.0.0.0", Utilities.getHost("hdfs: assertEquals("www.example.com", Utilities.getHost("www.example.com")); assertEquals("10.0.0.15", Utilities.getHost("10.0.0.15")); }