PathAttributeConfigurationImpl implements PathAttributeConfiguration { @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); for(PathAttribute a : attributes) builder.append(a); return builder.toHashCode(); } PathAttributeConfigurationImpl();   PathAttributeConfigurationImpl(Collection<PathAttribute> attributes); @Override Set<PathAttribute> getAttributes(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(PathAttributeConfiguration o);  }
@Test public void testHashCode() { PathAttributeConfiguration a = new PathAttributeConfigurationImpl(); PathAttributeConfiguration b = new PathAttributeConfigurationImpl(); PathAttributeConfiguration c = new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new LocalPrefPathAttribute(100))); PathAttributeConfiguration d = new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new LocalPrefPathAttribute(100))); PathAttributeConfiguration e = new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new LocalPrefPathAttribute(100), (PathAttribute)new MultiExitDiscPathAttribute(10))); PathAttributeConfiguration f = new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new MultiExitDiscPathAttribute(10), (PathAttribute)new LocalPrefPathAttribute(100))); Assert.assertTrue(a.hashCode() == b.hashCode()); Assert.assertTrue(c.hashCode() == d.hashCode()); Assert.assertTrue(e.hashCode() == f.hashCode()); Assert.assertFalse(a.hashCode() == c.hashCode()); Assert.assertFalse(a.hashCode() == e.hashCode()); Assert.assertFalse(c.hashCode() == e.hashCode()); }