AllowedOperation { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AllowedOperation other = (AllowedOperation) obj; if (name == null) { return other.name == null; } else { return name.equals(other.name); } }  Map<String, Set<String>> getItems(); void setItems(Map<String, Set<String>> items); String getName(); void setName(String name); boolean isOperationAllowedOn(String opItemType, String opItemValue, MatchType matchType); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEqualsSameObject() { AllowedOperation op1 = new AllowedOperation(); assertTrue(op1.equals(op1)); }
@Test public void testEqualsObjctIsNull() { AllowedOperation op1 = new AllowedOperation(); assertFalse(op1.equals(null)); }
@Test public void testEqualsDifferentClass() { AllowedOperation op1 = new AllowedOperation(); assertFalse(op1.equals("fail")); }
@Test public void testEqualsBothNameIsNull() { AllowedOperation op1 = new AllowedOperation(); AllowedOperation op2 = new AllowedOperation(); assertTrue(op1.equals(op2)); }