KeyValueMapKey { @Override public int hashCode() { return hashCode; } KeyValueMapKey(final MapDefinition mapDefinition, final String key); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test void testEqualsAndHashcode() { KeyValueMapKey key1 = new KeyValueMapKey( new MapDefinition( new RefStreamDefinition("uid1", "ver1", 123L), "myMap"), "myKey"); KeyValueMapKey key2 = new KeyValueMapKey( new MapDefinition( new RefStreamDefinition("uid1", "ver1", 123L), "myMap"), "myKey"); assertThat(key1).isEqualTo(key2); assertThat(key1.hashCode()).isEqualTo(key2.hashCode()); }
@Test void testEqualsAndHashcode_differentKey() { KeyValueMapKey key1 = new KeyValueMapKey( new MapDefinition( new RefStreamDefinition("uid1", "ver1", 123L), "myMap"), "myKeyxxxxxx"); KeyValueMapKey key2 = new KeyValueMapKey( new MapDefinition( new RefStreamDefinition("uid1", "ver1", 123L), "myMap"), "myKey"); assertThat(key1).isNotEqualTo(key2); assertThat(key1.hashCode()).isNotEqualTo(key2.hashCode()); }