### Question:
WebSensorTask extends TimerTask { public List<String[]> pollSensor() { setDatesPollInterval(); List<String[]> data = null; Call<List<String[]>> call = webApi.getHcJsonData(getQueryParameters()); try { data = call.execute().body(); for (String[] dataArray: data) { log.info("Time: " + dataArray[0] + " Data: " + dataArray[1]); SensorLog sensorLog = new SensorLog( config.getId(), ImmutableMap.of(config.getStringProperty(WebSensor.CONFIG_KEY_SUB_SENSOR), dataArray[1]), LocalDateTime.ofEpochSecond(Long.valueOf(dataArray[0])/1000, 0, ZoneOffset.UTC) ); processor.onNext(sensorLog); } } catch (IOException e) { e.printStackTrace(); log.warn("This sensor may not be returning data please check the sensor api webpage."); } return data; } WebSensorTask(SensorConfig webSensorConfig, int pollIntervalMinutes, FlowableProcessor<SensorLog> processor, UtsWebApi webApi); void setDatesPollInterval(); List<String[]> pollSensor(); @Override void run();  }### Answer:
@Test public void testSensorTask() throws IOException { SensorConfig webSensorConfig1 = new SensorConfig("web", ImmutableMap.of( WebSensor.CONFIG_KEY_FAMILY, "wasp", WebSensor.CONFIG_KEY_SENSOR, "ES_B_05_416_7C15", WebSensor.CONFIG_KEY_SUB_SENSOR, "BAT" )); MockWebServer server = new MockWebServer(); server.enqueue(new MockResponse().setBody("[[1508752848000,91],[1508753270000,92],[1508753692000,92],[1508754114000,87]]")); server.start(); Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("").toString()) .addConverterFactory(JacksonConverterFactory.create()) .build(); ReplayProcessor<SensorLog> processor = ReplayProcessor.create(10); WebSensorTask webSensorTask = new WebSensorTask(webSensorConfig1, 360, processor, retrofit.create(UtsWebApi.class)); webSensorTask.pollSensor(); SensorLog createdLog = null; try { createdLog = processor.timeout(5000, TimeUnit.MILLISECONDS).blockingFirst(); } catch (Exception e) { if (e.getMessage().equals("java.util.concurrent.TimeoutException")) { } else { throw e; } } if (createdLog != null) { assertThat(createdLog.getSensorId()).matches(webSensorConfig1.getId()); assertThat(createdLog.getAttributeValue()).hasSize(1); } }