SocketInfo { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SocketInfo other = (SocketInfo) obj; if (socketPath == null) { if (other.socketPath != null) { return false; } } else if (!socketPath.equals(other.socketPath)) { return false; } if (socketPrefix == null) { if (other.socketPrefix != null) { return false; } } else if (!socketPrefix.equals(other.socketPrefix)) { return false; } if (vhostuserMode == null) { if (other.vhostuserMode != null) { return false; } } else if (!vhostuserMode.equals(other.vhostuserMode)) { return false; } return true; } SocketInfo(String socketPath, String socketPrefix, String vhostuserMode); String getSocketPath(); String getSocketPrefix(); String getVhostuserMode(); String getVhostUserSocket(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void equalTest() { Assert.assertTrue(socketInfo.equals(socketInfo)); Assert.assertFalse(socketInfo.equals(null)); Assert.assertFalse(socketInfo.equals(0)); Assert.assertFalse(socketInfo.equals(new SocketInfo(ALT_SOCKET_PATH, SOCKET_PREFIX, VHOSTUSER_MODE))); Assert.assertFalse(socketInfo.equals(new SocketInfo(SOCKET_PATH, ALT_SOCKET_PREFIX, VHOSTUSER_MODE))); Assert.assertFalse(socketInfo.equals(new SocketInfo(SOCKET_PATH, SOCKET_PATH, ALT_VHOSTUSER_MODE))); }