### Question:
Connector { @Override public int hashCode() { return m_hostString.hashCode() ^ m_port ^ m_connectionType.hashCode(); } Connector(String hostString,
                   int port,
                   ConnectionType connectionType); @Override int hashCode(); @Override boolean equals(Object o); String getEndpointAsString();  }### Answer:
@Test public void testEquality() throws Exception { final Connector connector = new Connector("a", 1234, ConnectionType.WORKER); assertEquals(connector.hashCode(), connector.hashCode()); assertEquals(connector, connector); assertNotEquals(connector, null); assertNotEquals(connector, this); final Connector[] equal = { new Connector("a", 1234, ConnectionType.WORKER), }; final Connector[] notEqual = { new Connector("a", 6423, ConnectionType.WORKER), new Connector("b", 1234, ConnectionType.WORKER), new Connector("a", 1234, ConnectionType.AGENT), }; for (int i = 0; i < equal.length; ++i) { assertEquals(connector.hashCode(), equal[i].hashCode()); assertEquals(connector, equal[i]); } for (int i = 0; i < notEqual.length; ++i) { assertNotEquals(connector, notEqual[i]); } }