### Question:
Endpoint { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Endpoint)) { return false; } Endpoint<?> that = (Endpoint<?>) obj; return this.boundType == that.boundType && this.value.equals(that.value); } Endpoint(T value, BoundType boundType); T getValue(); BoundType getBoundType(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); String toLeftString(); String toRightString();  }### Answer:
@Test public void testEquals() throws Exception { Endpoint<Integer> endpoint = new Endpoint<Integer>(1, BoundType.OPEN); assertEquals("equals must be reflexive", endpoint, endpoint); assertEquals("hashCode must be reflexive", endpoint.hashCode(), endpoint.hashCode()); assertTrue(!endpoint.equals(null)); Object endpoint2 = new Endpoint<Integer>(1, BoundType.OPEN); if (endpoint.equals(endpoint2)) { assertEquals("equals implies hash equals", endpoint.hashCode(), endpoint2.hashCode()); assertEquals("equals must be symmetric", endpoint2, endpoint); } else { assertTrue("equals must be symmetric", !endpoint2.equals(endpoint)); } Object differentEndpoint = new Endpoint<Integer>(1, BoundType.CLOSED); assertTrue(!differentEndpoint.equals(endpoint)); assertTrue(differentEndpoint.hashCode() != endpoint.hashCode()); }