### Question:
CajaCssUtils { public static String extractIp6(String sUri) { if (sUri == null || sUri.length() < 7 || !sUri.startsWith("http")) { return null; } int beginFrom; if (sUri.charAt(4) == ':') { beginFrom = 7; } else if (sUri.charAt(4) == 's') { beginFrom = 8; } else { return null; } int firstSlash = sUri.indexOf('/', beginFrom); if (firstSlash == -1) firstSlash = sUri.length(); String authority = sUri.substring(beginFrom, firstSlash); int lastColon = authority.lastIndexOf(':'); if (lastColon == -1) { return null; } else { int openBracket = authority.lastIndexOf('['); if (openBracket == -1) { String untilColon = authority.substring(0, lastColon); boolean moreColons = untilColon.lastIndexOf(':') > -1; if (moreColons) { return authority; } else { return null; } } else { int closeBracket = authority.lastIndexOf(']'); return authority.substring(openBracket, closeBracket + 1); } } } private  CajaCssUtils(); static List<T> children(CssTree node, Class<T> nodeType); static List<T> descendants(CssTree node, final Class<T> nodeType); static void saveIp6Uris(CssTree.StyleSheet styleSheet, List<String> ip6Uris); static String restoreIp6Uris(String styleSheet, List<String> ip6Uris); static String extractIp6(String sUri);  }### Answer:
@Test public void isIp6Test() throws Exception { assertNull(CajaCssUtils.extractIp6(null)); assertNull(CajaCssUtils.extractIp6("")); assertNull(CajaCssUtils.extractIp6("http")); assertNull(CajaCssUtils.extractIp6("http")); assertNull(CajaCssUtils.extractIp6("http: assertNull(CajaCssUtils.extractIp6("http: assertNull(CajaCssUtils.extractIp6("http: assertNull(CajaCssUtils.extractIp6("https: assertNull(CajaCssUtils.extractIp6("https: assertNull(CajaCssUtils.extractIp6("https: assertEquals("[::1]", CajaCssUtils.extractIp6("http: assertEquals("[::1]", CajaCssUtils.extractIp6("http: assertEquals("2001:cdba:0000:0000:0000:0000:3257:9652", CajaCssUtils.extractIp6("http: assertEquals("[2001:cdba:0000:0000:0000:0000:3257:9652]", CajaCssUtils.extractIp6("http: }