AddressFamilyRoutingConfigurationImpl implements AddressFamilyRoutingConfiguration { @Override public boolean equals(Object obj) { if(!(obj instanceof AddressFamilyRoutingConfiguration)) return false; return (compareTo((AddressFamilyRoutingConfiguration)obj) == 0); } AddressFamilyRoutingConfigurationImpl();   AddressFamilyRoutingConfigurationImpl(AddressFamilyKey key, Collection<RouteConfiguration> routes); @Override AddressFamilyKey getKey(); @Override Set<RouteConfiguration> getRoutes(); @Override int compareTo(AddressFamilyRoutingConfiguration o); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEquals() { AddressFamilyRoutingConfiguration a = new AddressFamilyRoutingConfigurationImpl(AddressFamilyKey.IPV4_UNICAST_FORWARDING, null); AddressFamilyRoutingConfiguration b = new AddressFamilyRoutingConfigurationImpl(AddressFamilyKey.IPV4_UNICAST_FORWARDING, null); AddressFamilyRoutingConfiguration c = new AddressFamilyRoutingConfigurationImpl(AddressFamilyKey.IPV4_UNICAST_FORWARDING, Arrays.asList((RouteConfiguration)new RouteConfigurationImpl(new NetworkLayerReachabilityInformation(0, null), new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new LocalPrefPathAttribute(100), (PathAttribute)new MultiExitDiscPathAttribute(1)))))); AddressFamilyRoutingConfiguration d = new AddressFamilyRoutingConfigurationImpl(AddressFamilyKey.IPV4_UNICAST_FORWARDING, Arrays.asList((RouteConfiguration)new RouteConfigurationImpl(new NetworkLayerReachabilityInformation(0, null), new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new MultiExitDiscPathAttribute(1), (PathAttribute)new LocalPrefPathAttribute(100)))))); AddressFamilyRoutingConfiguration e = new AddressFamilyRoutingConfigurationImpl(AddressFamilyKey.IPV4_UNICAST_FORWARDING, Arrays.asList((RouteConfiguration)new RouteConfigurationImpl(new NetworkLayerReachabilityInformation(0, null), new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new LocalPrefPathAttribute(100), (PathAttribute)new MultiExitDiscPathAttribute(1)))), (RouteConfiguration)new RouteConfigurationImpl(new NetworkLayerReachabilityInformation(16, new byte[] {(byte)0xc0, (byte)0xa8} ), new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new LocalPrefPathAttribute(100), (PathAttribute)new MultiExitDiscPathAttribute(1)))))); AddressFamilyRoutingConfiguration f = new AddressFamilyRoutingConfigurationImpl(AddressFamilyKey.IPV4_UNICAST_FORWARDING, Arrays.asList((RouteConfiguration)new RouteConfigurationImpl(new NetworkLayerReachabilityInformation(16, new byte[] {(byte)0xc0, (byte)0xa8} ), new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new LocalPrefPathAttribute(100), (PathAttribute)new MultiExitDiscPathAttribute(1)))), (RouteConfiguration)new RouteConfigurationImpl(new NetworkLayerReachabilityInformation(0, null), new PathAttributeConfigurationImpl(Arrays.asList((PathAttribute)new LocalPrefPathAttribute(100), (PathAttribute)new MultiExitDiscPathAttribute(1)))))); Assert.assertTrue(a.equals(b)); Assert.assertTrue(c.equals(d)); Assert.assertTrue(e.equals(f)); Assert.assertTrue(a.hashCode() == b.hashCode()); Assert.assertTrue(c.hashCode() == d.hashCode()); Assert.assertTrue(e.hashCode() == f.hashCode()); Assert.assertTrue(a.compareTo(b) == 0); Assert.assertTrue(c.compareTo(d) == 0); Assert.assertTrue(e.compareTo(f) == 0); }