BgpServerConfigurationImpl implements BgpServerConfiguration { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BgpServerConfigurationImpl other = (BgpServerConfigurationImpl) obj; if (serverConfiguration == null) { if (other.serverConfiguration != null) return false; } else if (!serverConfiguration.equals(other.serverConfiguration)) return false; return true; } BgpServerConfigurationImpl();  BgpServerConfigurationImpl(ServerConfiguration serverConfiguration); @Override ServerConfiguration getServerConfiguration(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testEquals() throws Exception { BgpServerConfigurationImpl server1 = new BgpServerConfigurationImpl(new ServerConfigurationImpl(InetAddress.getByName("192.168.4.1"), 100)); BgpServerConfigurationImpl server2 = new BgpServerConfigurationImpl(new ServerConfigurationImpl(InetAddress.getByName("192.168.4.1"), 100)); BgpServerConfigurationImpl server3 = new BgpServerConfigurationImpl(new ServerConfigurationImpl(InetAddress.getByName("192.168.4.2"), 100)); BgpServerConfigurationImpl server4 = new BgpServerConfigurationImpl(new ServerConfigurationImpl(InetAddress.getByName("192.168.4.1"), 200)); Assert.assertTrue(server1.equals(server2)); Assert.assertFalse(server1.equals(server3)); Assert.assertFalse(server1.equals(server4)); }