use of il.ac.technion.cs.smarthouse.utils.BoolLatch in project Smartcity-Smarthouse by TechnionYP5777.
the class SensorApiTest method subscribeOnTimeTest.
@Test(timeout = 4000)
public void subscribeOnTimeTest() {
final BoolLatch wasCalled = new BoolLatch();
SensorApi<MySensor> s = getSensor(SENSOR_COMM_NAME, MySensor.class, null);
Assert.assertEquals(s.isConnected(), false);
sensorConnect();
Assert.assertEquals(s.isConnected(), true);
s.subscribeOnTime(sensorData -> {
Assert.assertEquals(sensorData.getParam1(), 0);
Assert.assertEquals(sensorData.getCommercialName(), SENSOR_COMM_NAME);
Assert.assertEquals(sensorData.getSensorLocation(), SensorLocation.UNDEFINED);
wasCalled.setTrueAndRelease();
}, LocalTime.now().plusSeconds(2));
wasCalled.blockUntilTrue();
}
Aggregations