### Question:
RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); Iterator<RestrictedByElem> iterator(); @Override int hashCode(); @Override boolean equals( Object o ); @Override String toString();  }### Answer:
@Test public void testHashCodeReflexive() throws Exception { assertEquals( restrictedByItemA.hashCode(), restrictedByItemA.hashCode() ); }
@Test public void testHashCodeSymmetric() throws Exception { assertEquals( restrictedByItemA.hashCode(), restrictedByItemACopy.hashCode() ); assertEquals( restrictedByItemACopy.hashCode(), restrictedByItemA.hashCode() ); }
@Test public void testHashCodeTransitive() throws Exception { assertEquals( restrictedByItemA.hashCode(), restrictedByItemACopy.hashCode() ); assertEquals( restrictedByItemACopy.hashCode(), restrictedByItemB.hashCode() ); assertEquals( restrictedByItemA.hashCode(), restrictedByItemB.hashCode() ); }