HostGroupConfigEntityPK { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HostGroupConfigEntityPK that = (HostGroupConfigEntityPK) o; return this.blueprintName.equals(that.blueprintName) && this.hostGroupName.equals(that.hostGroupName) && this.type.equals(that.type); }  String getBlueprintName(); void setBlueprintName(String blueprintName); String getHostGroupName(); void setHostGroupName(String hostGroupName); String getType(); void setType(String type); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { HostGroupConfigEntityPK pk1 = new HostGroupConfigEntityPK(); HostGroupConfigEntityPK pk2 = new HostGroupConfigEntityPK(); pk1.setType("foo"); pk2.setType("foo"); pk1.setBlueprintName("bp"); pk2.setBlueprintName("bp"); pk1.setHostGroupName("hg"); pk2.setHostGroupName("hg"); assertEquals(pk1, pk2); pk1.setType("something_else"); assertFalse(pk1.equals(pk2)); pk2.setType("something_else"); assertEquals(pk1, pk2); pk1.setType("other_type"); assertFalse(pk1.equals(pk2)); pk2.setType("other_type"); assertEquals(pk1, pk2); pk1.setHostGroupName("hg2"); assertFalse(pk1.equals(pk2)); }