ResourceUrn implements IResourceUrn { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if(!(obj instanceof ResourceUrn)) { return false; } ResourceUrn other = (ResourceUrn) obj; if (m_path == null) { if (other.m_path != null) return false; } else if (!m_path.equals(other.m_path)) return false; if (m_type == null) { if (other.m_type != null) return false; } else if (!m_type.equals(other.m_type)) return false; if (m_namespace == null) { if (other.m_namespace != null) return false; } else if (!m_namespace.equals(other.m_namespace)) return false; return true; } ResourceUrn(String type, String namespace, String resourcePath); @Override boolean equals(Object obj); @Override String getNamespace(); @Override String getPath(); @Override String getType(); @Override int hashCode(); @Override String toString();  }
@Test public void testUrnEquals() { ResourceUrn urn = new ResourceUrn("js", "local", "/js/sample/sample1.js"); ResourceUrn urn1 = new ResourceUrn(null, "local", "/js/sample/sample1.js"); ResourceUrn urn2 = new ResourceUrn("js", null, "/js/sample/sample1.js"); ResourceUrn urn4 = null; ResourceUrn urn5 = new ResourceUrn("css", "local", "/js/sample/sample1.js"); ResourceUrn urn6 = new ResourceUrn("js", "global", "/js/sample/sample1.js"); Assert.assertFalse(urn.equals(urn4)); Assert.assertFalse(urn1.equals(urn)); Assert.assertFalse(urn.equals(urn5)); Assert.assertFalse(urn2.equals(urn)); Assert.assertFalse(urn.equals(urn6)); }