@Test public void shouldSkipMeasurementsFromDisabledStreams() { sessionManager.state.recording().startRecording(); when(sensor.isEnabled()).thenReturn(false); triggerMeasurement(); assertThat(sessionManager.getMeasurementStreams().isEmpty(), equalTo(true)); }
private void mockSensors() { sessionManager.locationHelper = mock(LocationHelper.class); sessionManager.audioReader = mock(SimpleAudioReader.class); sessionManager.externalSensors = mock(ExternalSensors.class); sessionManager.eventBus = mock(EventBus.class); sessionManager.sensorManager = mock(SensorManager.class); sensor = mock(Sensor.class); when(sensor.isEnabled()).thenReturn(true); when(sensor.getSensorName()).thenReturn("LHC"); when(sessionManager.locationHelper.getLastLocation()).thenReturn(location); when(sessionManager.sensorManager.getSensorByName(Mockito.any(String.class))) .thenReturn(sensor); }