KindAndName { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; KindAndName that = (KindAndName) o; if (!kind.equals(that.kind)) return false; return name.equals(that.name); } KindAndName(String kind, String name);  KindAndName(HasMetadata item); String getKind(); String getName(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void equalsTest(){ KindAndName kindAndName = new KindAndName("kindTest","nameTest"); KindAndName secondKindAndName = new KindAndName("kindTest","nameTest"); KindAndName thirdKindAndName = new KindAndName("kindTest1","nameTest1"); KindAndName fourthKindAndName = new KindAndName("kindTest1","nameTest"); KindAndName fifthKindAndName = new KindAndName("kindTest","nameTest1"); assertTrue(kindAndName.equals(kindAndName)); assertFalse(kindAndName.equals(null)); assertTrue(kindAndName.equals(secondKindAndName)); assertFalse(kindAndName.equals(thirdKindAndName)); assertFalse(kindAndName.equals(fourthKindAndName)); assertFalse(kindAndName.equals(fifthKindAndName)); }