SessionManager { public void unlinkWs(String wsid) { if(wsid != null && wsid_httpid.containsKey(wsid)) { String httpid = wsid_httpid.remove(wsid); getValidSessionsElseRemove(httpid, new IsOpenAndDifferentPredicate(wsid)); } }  void linkWsToHttp(Session ws, String httpid); void unlinkWs(String wsid); Collection<Session> getUserSessions(String httpid);  }
@Test public void testUnlinkWs() { System.out.println("unlinkWs"); String wsid = "WSID"; String httpid = "HTTPID"; when(wsid_httpid.containsKey(eq("WSID"))).thenReturn(Boolean.TRUE); when(wsid_httpid.remove(eq(wsid))).thenReturn(httpid); instance.unlinkWs(wsid); verify(wsid_httpid).remove(eq(wsid)); verify(instance).getValidSessionsElseRemove(eq(httpid), any(IsOpenAndDifferentPredicate.class)); }