@Test public void should_not_crashOnDeletedSensor() throws Exception { // given SensorEvent event = new SensorEvent("CERN", "LHC", "Siggh boson", "SB", "number", "#", 1, 2, 3, 4, 5, 10); sessionManager.onEvent(event); // when sessionManager.deleteSensorStream(event.getSensorName()); // then (shouldn't crash) sessionManager.onEvent(event); }
@Test public void shouldCreateAStreamForEachSensor() { sessionManager.startMobileSession(false); triggerMeasurement(); SensorEvent event = new SensorEvent("CERN", "LHC2", "Siggh boson", "SB", "number", "#", 1, 2, 3, 4, 5, 10); sessionManager.onEvent(event); MeasurementStream expected = event.stream(); assertThat(sessionManager.getMeasurementStreams(), hasItem(expected)); }
private void triggerMeasurement(String name, double value) { lastEvent = New.sensorEvent(name, value); sessionManager.onEvent(lastEvent); }