@Test public void testSecurityFalse() { EventListener callback2 = mock(EventListener.class); nestConnector.addDeviceListener( Keys.THERMOSTATS, THERMOSTAT_ID, Keys.THERMOSTAT.HVAC_MODE, callback2); nestConnector.setDeviceParam( Keys.SMOKE_CO_ALARMS, PROTECT_ID, Keys.SMOKE_CO_ALARM.CO_ALARM_STATE, Keys.SMOKE_CO_ALARM.SMOKE_ALARM_STATES.OK); service.setSecurity(false); nestConnector.setDeviceParam( Keys.THERMOSTATS, THERMOSTAT_ID, Keys.THERMOSTAT.HVAC_MODE, Keys.THERMOSTAT.HVAC_MODES.HEAT_COOL); nestConnector.setDeviceParam( Keys.SMOKE_CO_ALARMS, PROTECT_ID, Keys.SMOKE_CO_ALARM.CO_ALARM_STATE, Keys.SMOKE_CO_ALARM.SMOKE_ALARM_STATES.WARNING); verify(callback2, timeout(10000)).onDataChange(Keys.THERMOSTAT.HVAC_MODES.HEAT_COOL); }
@Test public void testFanTimerPassive() { EventListener callback = mock(EventListener.class); nestConnector.addDeviceListener( Keys.THERMOSTATS, THERMOSTAT_ID, Keys.THERMOSTAT.FAN_TIMER_ACTIVE, callback); nestConnector.setDeviceParam( Keys.THERMOSTATS, THERMOSTAT_ID, Keys.THERMOSTAT.FAN_TIMER_ACTIVE, false); verify(callback, timeout(30000)).onDataChange("false"); }
@Test public void testSecurityTrue() { EventListener callback = mock(EventListener.class); nestConnector.addDeviceListener( Keys.THERMOSTATS, THERMOSTAT_ID, Keys.THERMOSTAT.HVAC_MODE, callback); nestConnector.setDeviceParam( Keys.THERMOSTATS, THERMOSTAT_ID, Keys.THERMOSTAT.HVAC_MODE, Keys.THERMOSTAT.HVAC_MODES.HEAT_COOL); service.setSecurity(true); nestConnector.setDeviceParam( Keys.SMOKE_CO_ALARMS, PROTECT_ID, Keys.SMOKE_CO_ALARM.CO_ALARM_STATE, Keys.SMOKE_CO_ALARM.SMOKE_ALARM_STATES.EMERGENCY); verify(callback, timeout(10000)).onDataChange(Keys.THERMOSTAT.HVAC_MODES.OFF); }
@Before public void setUp() throws Exception { AuthenticationListener callback = mock(AuthenticationListener.class); nestConnector.authenticate(callback); }