InMemoryKey { public InMemoryKey(InMemoryKey parentKey, String kind, String name) { if (null == kind) { throw new IllegalArgumentException("Kind cannot be null"); } this.parentKey = parentKey; this.kind = kind; this.name = name; } InMemoryKey(InMemoryKey parentKey, String kind, String name); static InMemoryKey of(InMemoryKey parentKey, String kind, String name); @Override boolean equals(Object obj); @Override int hashCode(); String getKind(); String getName(); InMemoryKey getParentKey(); @Override String toString();  }
@Test public void testInMemoryKey() { HashSet<InMemoryKey> set = new HashSet<InMemoryKey>(); InMemoryKey one = new InMemoryKey(null, "one", "one"); set.add(one); InMemoryKey uno = new InMemoryKey(null, "one", "one"); set.add(uno); assertEquals(one, uno); assertEquals(1, set.size()); InMemoryKey two = new InMemoryKey(null, "one", "two"); set.add(two); assertNotEquals(one, two); assertEquals(2, set.size()); }