@Test public void shouldNotifyListenersOnSessionClobber() { sessionManager.getSession().setId(1234); sessionManager.discardSession(); verify(sessionManager.eventBus).post(Mockito.any(SessionChangeEvent.class)); }
@Test public void shouldDiscardASession() { sessionManager.startMobileSession(false); sessionManager.getSession().setId(1234); triggerMeasurement(13.5); sessionManager.discardSession(); verify(sessionManager.audioReader, never()).stop(); verify(sessionManager.locationHelper).stop(); verify(sessionManager.sessionRepository, never()).save(Mockito.any(Session.class)); assertThat(sessionManager.getMeasurementStreams().isEmpty(), equalTo(true)); assertThat(sessionManager.isSessionStarted(), equalTo(false)); }
public void deleteSession() { Long sessionId = session.getId(); sessionRepository.markSessionForRemoval(sessionId); discardSession(sessionId); }
@VisibleForTesting void discardSession() { Long sessionId = getSession().getId(); discardSession(sessionId); }