@Ignore("needs to check if finishing creates a proper task") @Test public void shouldSetSessionEnd() { sessionManager.startMobileSession(false); triggerMeasurement(); sessionManager.finishSession(0); verify(sessionManager.sessionRepository) .save( Mockito.argThat( new BaseMatcher<Session>() { @Override public boolean matches(Object o) { Session other = (Session) o; long oneSecond = 1000; return new Date().getTime() - other.getEnd().getTime() < oneSecond; } @Override public void describeTo(Description description) { description.appendText("Session with end set"); } })); }
@Ignore("needs to check if finishing creates a proper task") @Test public void shouldSaveAdditionalData() { triggerMeasurement(100); sessionManager.finishSession(0); verify(sessionManager.sessionRepository) .save( Mockito.argThat( new BaseMatcher<Session>() { @Override public boolean matches(Object o) { Session session = (Session) o; return session.getCalibration() == 123 && session.getOffset60DB() == 432 && "1.1.1".equals(session.getOSVersion()) && "very old".equals(session.getPhoneModel()); } @Override public void describeTo(Description description) { description.appendText("Session with additional data set"); } })); }
@Ignore("Fix session persistence") @Test public void shouldStopASession() { triggerMeasurement(11); sessionManager.finishSession(0); verify(sessionManager.audioReader, never()).stop(); verify(sessionManager.locationHelper).stop(); verify(sessionManager.sessionRepository).save(Mockito.any(Session.class)); assertThat(sessionManager.isSessionStarted(), equalTo(false)); }