ConfigCacheKey { public ConfigCacheKey(ConfigKey<?> key, String defMd5) { this.key = key; this.defMd5 = defMd5 == null ? "" : defMd5; } ConfigCacheKey(ConfigKey<?> key, String defMd5);   ConfigCacheKey(String name, String configIdString, String namespace, String defMd5); @Override int hashCode(); @Override boolean equals(Object o); String getDefMd5(); ConfigKey<?> getKey(); @Override String toString();  }
@Test public void testConfigCacheKey() { final String defMd5 = "md5"; final String defMd5_2 = "md5_2"; ConfigCacheKey k1 = new ConfigCacheKey("foo", "id", "ns", defMd5); ConfigCacheKey k2 = new ConfigCacheKey("foo", "id", "ns", defMd5); ConfigCacheKey k3 = new ConfigCacheKey("foo", "id", "ns", defMd5_2); ConfigCacheKey k4 = new ConfigCacheKey("foo", "id", "ns_1", defMd5); ConfigCacheKey k5 = new ConfigCacheKey("foo", "id", "ns_1", null); final ConfigKey<?> configKey = new ConfigKey<>("foo", "id", "ns"); ConfigCacheKey k1_2 = new ConfigCacheKey(configKey, defMd5); assertEquals(k1, k1); assertEquals(k1, k1_2); assertEquals(k1, k2); assertNotEquals(k3, k2); assertNotEquals(k4, k1); assertThat(k1.hashCode(), is(k2.hashCode())); assertThat(k1.getDefMd5(), is(defMd5)); assertThat(k1.toString(), is(configKey.toString() + "," + defMd5)); assertThat(k5.hashCode(), is(not(k1.hashCode()))); }