ResourceCacheKey { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ResourceCacheKey other = (ResourceCacheKey) obj; if (m_locale == null) { if (other.m_locale != null) return false; } else if (!m_locale.equals(other.m_locale)) return false; if (m_urn == null) { if (other.m_urn != null) return false; } else if (!m_urn.equals(other.m_urn)) return false; return true; } ResourceCacheKey(IResourceUrn urn, IResourceLocale locale); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void testEquals() { IResourceUrn urn = new ResourceUrn("js", "local", "/js/sample/sample.js"); IResourceUrn urn1 = new ResourceUrn("js", "local", "/js/sample/sample1.js"); IResourceLocale locale = new ResourceLocale(new Locale("en", "US")); IResourceLocale locale1 = new ResourceLocale(new Locale("de", "DE")); ResourceCacheKey cacheKey = new ResourceCacheKey(urn, locale); Assert.assertTrue(cacheKey.equals(cacheKey)); Assert.assertFalse(cacheKey.equals(null)); Assert.assertFalse(cacheKey.equals(new Object())); ResourceCacheKey cacheKey1 = new ResourceCacheKey(urn, null); Assert.assertFalse(cacheKey1.equals(cacheKey)); ResourceCacheKey cacheKey2 = new ResourceCacheKey(urn, locale1); Assert.assertFalse(cacheKey2.equals(cacheKey)); ResourceCacheKey cacheKey3 = new ResourceCacheKey(null, locale); Assert.assertFalse(cacheKey3.equals(cacheKey)); ResourceCacheKey cacheKey4 = new ResourceCacheKey(urn1, locale); Assert.assertFalse(cacheKey4.equals(cacheKey)); ResourceCacheKey cacheKey5 = new ResourceCacheKey(urn, locale); Assert.assertTrue(cacheKey5.equals(cacheKey)); }