private TestSession createTestSession() { final HashMap<String, Object> capabilities = new HashMap<String, Object>(); final TestSessionTest.TestTimeSource timeSource = new TestSessionTest.TestTimeSource(); // Luckily we can pass null for TestSlot TestSession testSession = new TestSession(null, capabilities, timeSource); testSession.setExternalKey(new ExternalSessionKey("w00t!")); return testSession; }
@Test public void testRemoveWithoutExternalKey() throws Exception { TestSession testSession = createTestSession(); testSession.setExternalKey(null); activeTestSessions.add(testSession); assertEquals(1, activeTestSessions.unmodifiableSet().size()); activeTestSessions.remove(testSession, SessionTerminationReason.CLIENT_STOPPED_SESSION); assertEquals(0, activeTestSessions.unmodifiableSet().size()); }