@Test public void testEquals() { String url = "http: Uri createdUri = Uri.create(url); Uri constructedUri = new Uri("http", "user", "hello.com", 8080, "/level1/level2/level3", "q=1", null); assertTrue(createdUri.equals(constructedUri), "The equals method returned false for two equal urls"); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Uri other = (Uri) obj; if (host == null) { if (other.host != null) return false; } else if (!host.equals(other.host)) return false; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; if (port != other.port) return false; if (query == null) { if (other.query != null) return false; } else if (!query.equals(other.query)) return false; if (scheme == null) { if (other.scheme != null) return false; } else if (!scheme.equals(other.scheme)) return false; if (userInfo == null) { if (other.userInfo != null) return false; } else if (!userInfo.equals(other.userInfo)) return false; if (fragment == null) { if (other.fragment != null) return false; } else if (!fragment.equals(other.fragment)) return false; return true; }
Uri { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Uri other = (Uri) obj; if (host == null) { if (other.host != null) return false; } else if (!host.equals(other.host)) return false; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; if (port != other.port) return false; if (query == null) { if (other.query != null) return false; } else if (!query.equals(other.query)) return false; if (scheme == null) { if (other.scheme != null) return false; } else if (!scheme.equals(other.scheme)) return false; if (userInfo == null) { if (other.userInfo != null) return false; } else if (!userInfo.equals(other.userInfo)) return false; if (fragment == null) { if (other.fragment != null) return false; } else if (!fragment.equals(other.fragment)) return false; return true; } }
Uri { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Uri other = (Uri) obj; if (host == null) { if (other.host != null) return false; } else if (!host.equals(other.host)) return false; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; if (port != other.port) return false; if (query == null) { if (other.query != null) return false; } else if (!query.equals(other.query)) return false; if (scheme == null) { if (other.scheme != null) return false; } else if (!scheme.equals(other.scheme)) return false; if (userInfo == null) { if (other.userInfo != null) return false; } else if (!userInfo.equals(other.userInfo)) return false; if (fragment == null) { if (other.fragment != null) return false; } else if (!fragment.equals(other.fragment)) return false; return true; } Uri(String scheme,
             String userInfo,
             String host,
             int port,
             String path,
             String query,
             String fragment); }
Uri { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Uri other = (Uri) obj; if (host == null) { if (other.host != null) return false; } else if (!host.equals(other.host)) return false; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; if (port != other.port) return false; if (query == null) { if (other.query != null) return false; } else if (!query.equals(other.query)) return false; if (scheme == null) { if (other.scheme != null) return false; } else if (!scheme.equals(other.scheme)) return false; if (userInfo == null) { if (other.userInfo != null) return false; } else if (!userInfo.equals(other.userInfo)) return false; if (fragment == null) { if (other.fragment != null) return false; } else if (!fragment.equals(other.fragment)) return false; return true; } Uri(String scheme,
             String userInfo,
             String host,
             int port,
             String path,
             String query,
             String fragment); static Uri create(String originalUrl); static Uri create(Uri context, final String originalUrl); String getQuery(); String getPath(); String getUserInfo(); int getPort(); String getScheme(); String getHost(); String getFragment(); boolean isSecured(); boolean isWebSocket(); URI toJavaNetURI(); int getExplicitPort(); int getSchemeDefaultPort(); String toUrl(); String toBaseUrl(); String toRelativeUrl(); String toFullUrl(); String getBaseUrl(); String getAuthority(); boolean isSameBase(Uri other); String getNonEmptyPath(); @Override String toString(); Uri withNewScheme(String newScheme); Uri withNewQuery(String newQuery); @Override int hashCode(); @Override boolean equals(Object obj); static void validateSupportedScheme(Uri uri); }
Uri { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Uri other = (Uri) obj; if (host == null) { if (other.host != null) return false; } else if (!host.equals(other.host)) return false; if (path == null) { if (other.path != null) return false; } else if (!path.equals(other.path)) return false; if (port != other.port) return false; if (query == null) { if (other.query != null) return false; } else if (!query.equals(other.query)) return false; if (scheme == null) { if (other.scheme != null) return false; } else if (!scheme.equals(other.scheme)) return false; if (userInfo == null) { if (other.userInfo != null) return false; } else if (!userInfo.equals(other.userInfo)) return false; if (fragment == null) { if (other.fragment != null) return false; } else if (!fragment.equals(other.fragment)) return false; return true; } Uri(String scheme,
             String userInfo,
             String host,
             int port,
             String path,
             String query,
             String fragment); static Uri create(String originalUrl); static Uri create(Uri context, final String originalUrl); String getQuery(); String getPath(); String getUserInfo(); int getPort(); String getScheme(); String getHost(); String getFragment(); boolean isSecured(); boolean isWebSocket(); URI toJavaNetURI(); int getExplicitPort(); int getSchemeDefaultPort(); String toUrl(); String toBaseUrl(); String toRelativeUrl(); String toFullUrl(); String getBaseUrl(); String getAuthority(); boolean isSameBase(Uri other); String getNonEmptyPath(); @Override String toString(); Uri withNewScheme(String newScheme); Uri withNewQuery(String newQuery); @Override int hashCode(); @Override boolean equals(Object obj); static void validateSupportedScheme(Uri uri); static final String HTTP; static final String HTTPS; static final String WS; static final String WSS; }