LiveUpdateSession { @Override public boolean equals(final Object obj) { if (!(obj instanceof LiveUpdateSession)) { return false; } final LiveUpdateSession other = (LiveUpdateSession) obj; return this.session.equals(other.session); }  void sendMessage(final String message); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void testHashCodeAndEquals() { final WebSocketSession webSocketSession = mock(WebSocketSession.class); final LiveUpdateSession session1 = new LiveUpdateSession(webSocketSession); final LiveUpdateSession session2 = new LiveUpdateSession(webSocketSession); assertTrue(session1.equals(session2)); assertTrue(new HashSet<>(asList(session1)).contains(session2)); }