PeerConfigurationDecorator implements PeerConfiguration { public int hashCode() { return (new HashCodeBuilder()) .append(isAllowAutomaticStart()) .append(isAllowAutomaticStop()) .append(getAutomaticStartInterval()) .append(getCapabilities()) .append(getClientConfig()) .append(isCollisionDetectEstablishedState()) .append(getConnectRetryTime()) .append(isDampPeerOscillation()) .append(isDelayOpen()) .append(getDelayOpenTime()) .append(getHoldTime()) .append(isHoldTimerDisabled()) .append(getIdleHoldTime()) .append(getLocalAS()) .append(getLocalBgpIdentifier()) .append(isPassiveTcpEstablishment()) .append(getPeerName()) .append(getRemoteAS()) .append(getRemoteBgpIdentifier()) .toHashCode(); } protected  PeerConfigurationDecorator(PeerConfiguration decorated); ClientConfiguration getClientConfig(); int getLocalAS(); int getRemoteAS(); String getPeerName(); long getRemoteBgpIdentifier(); long getLocalBgpIdentifier(); int getHoldTime(); int getIdleHoldTime(); boolean isAllowAutomaticStart(); boolean isAllowAutomaticStop(); boolean isDampPeerOscillation(); boolean isPassiveTcpEstablishment(); boolean isDelayOpen(); int getDelayOpenTime(); boolean isCollisionDetectEstablishedState(); boolean equals(Object other); int hashCode(); int getConnectRetryTime(); @Override int getAutomaticStartInterval(); boolean isHoldTimerDisabled(); @Override Capabilities getCapabilities();  }
@Test public void testHashCode() throws Exception { PeerConfiguration cd1 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp1 = new MockPeerConfgurationDecorator(cd1); PeerConfiguration cd2 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp2 = new MockPeerConfgurationDecorator(cd2); PeerConfiguration cd3 = new PeerConfigurationImpl("bar", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp3 = new MockPeerConfgurationDecorator(cd3); PeerConfiguration cd4 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.5.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp4 = new MockPeerConfgurationDecorator(cd4); PeerConfiguration cd5 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24577, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp5 = new MockPeerConfgurationDecorator(cd5); PeerConfiguration cd6 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32769, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp6 = new MockPeerConfgurationDecorator(cd6); PeerConfiguration cd7 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80402L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp7 = new MockPeerConfgurationDecorator(cd7); PeerConfiguration cd8 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80502L, 60, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp8 = new MockPeerConfgurationDecorator(cd8); PeerConfiguration cd9 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 61, 300, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp9 = new MockPeerConfgurationDecorator(cd9); PeerConfiguration cd10 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 301, false, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp10 = new MockPeerConfgurationDecorator(cd10); PeerConfiguration cd11 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, true, 30, false, false, 0, false, false, false, 180, false); PeerConfiguration cp11 = new MockPeerConfgurationDecorator(cd11); PeerConfiguration cd12 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 31, false, false, 0, false, false, false, 180, false); PeerConfiguration cp12 = new MockPeerConfgurationDecorator(cd12); PeerConfiguration cd13 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, true, false, 0, false, false, false, 180, false); PeerConfiguration cp13 = new MockPeerConfgurationDecorator(cd13); PeerConfiguration cd14 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, true, 0, false, false, false, 180, false); PeerConfiguration cp14 = new MockPeerConfgurationDecorator(cd14); PeerConfiguration cd15 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 10, false, false, false, 180, false); PeerConfiguration cp15 = new MockPeerConfgurationDecorator(cd15); PeerConfiguration cd16 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, true, false, false, 180, false); PeerConfiguration cp16 = new MockPeerConfgurationDecorator(cd16); PeerConfiguration cd17 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, true, false, 180, false); PeerConfiguration cp17 = new MockPeerConfgurationDecorator(cd17); PeerConfiguration cd18 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, true, 180, false); PeerConfiguration cp18 = new MockPeerConfgurationDecorator(cd18); PeerConfiguration cd19 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 181, false); PeerConfiguration cp19 = new MockPeerConfgurationDecorator(cd19); PeerConfiguration cd20 = new PeerConfigurationImpl("foo", new ClientConfigurationImpl(InetAddress.getByName("192.168.4.1")), 24576, 32768, 0xc0a80401L, 0xc0a80501L, 60, 300, false, 30, false, false, 0, false, false, false, 180, true); PeerConfiguration cp20 = new MockPeerConfgurationDecorator(cd20); Assert.assertEquals(cp1.hashCode(), cp2.hashCode()); Assert.assertFalse(cp1.hashCode() == cp3.hashCode()); Assert.assertFalse(cp1.hashCode() == cp4.hashCode()); Assert.assertFalse(cp1.hashCode() == cp5.hashCode()); Assert.assertFalse(cp1.hashCode() == cp6.hashCode()); Assert.assertFalse(cp1.hashCode() == cp7.hashCode()); Assert.assertFalse(cp1.hashCode() == cp8.hashCode()); Assert.assertFalse(cp1.hashCode() == cp9.hashCode()); Assert.assertFalse(cp1.hashCode() == cp10.hashCode()); Assert.assertFalse(cp1.hashCode() == cp11.hashCode()); Assert.assertFalse(cp1.hashCode() == cp12.hashCode()); Assert.assertFalse(cp1.hashCode() == cp13.hashCode()); Assert.assertFalse(cp1.hashCode() == cp14.hashCode()); Assert.assertFalse(cp1.hashCode() == cp15.hashCode()); Assert.assertFalse(cp1.hashCode() == cp16.hashCode()); Assert.assertFalse(cp1.hashCode() == cp17.hashCode()); Assert.assertFalse(cp1.hashCode() == cp18.hashCode()); Assert.assertFalse(cp1.hashCode() == cp19.hashCode()); Assert.assertFalse(cp1.hashCode() == cp20.hashCode()); Assert.assertEquals(cp1.hashCode(), cd1.hashCode()); Assert.assertEquals(cp2.hashCode(), cd2.hashCode()); Assert.assertEquals(cp3.hashCode(), cd3.hashCode()); Assert.assertEquals(cp4.hashCode(), cd4.hashCode()); Assert.assertEquals(cp5.hashCode(), cd5.hashCode()); Assert.assertEquals(cp6.hashCode(), cd6.hashCode()); Assert.assertEquals(cp7.hashCode(), cd7.hashCode()); Assert.assertEquals(cp8.hashCode(), cd8.hashCode()); Assert.assertEquals(cp9.hashCode(), cd9.hashCode()); Assert.assertEquals(cp10.hashCode(), cd10.hashCode()); Assert.assertEquals(cp11.hashCode(), cd11.hashCode()); Assert.assertEquals(cp12.hashCode(), cd12.hashCode()); Assert.assertEquals(cp13.hashCode(), cd13.hashCode()); Assert.assertEquals(cp14.hashCode(), cd14.hashCode()); Assert.assertEquals(cp15.hashCode(), cd15.hashCode()); Assert.assertEquals(cp16.hashCode(), cd16.hashCode()); Assert.assertEquals(cp17.hashCode(), cd17.hashCode()); Assert.assertEquals(cp18.hashCode(), cd18.hashCode()); Assert.assertEquals(cp19.hashCode(), cd19.hashCode()); Assert.assertEquals(cp20.hashCode(), cd20.hashCode()); }