コード例 #1
0
  @Test
  public void testLowTargetTempC() {
    service.setMinTemperature(11.0);
    assertEquals(new Double(11.0), service.getMinTemperature());

    service.setMinTemperature(9.0);
    assertEquals(new Double(9.0), service.getMinTemperature());
  }
コード例 #2
0
  @Test
  public void testMaxTargetTempC() {
    service.setMaxTemperature(27.0);
    assertEquals(new Double(27.0), service.getMaxTemperature());

    service.setMaxTemperature(28.0);
    assertEquals(new Double(28.0), service.getMaxTemperature());
  }
コード例 #3
0
  @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);
  }
コード例 #4
0
 @Test
 public void testServiceTemperature() {
   service.setTemperature(25.0);
   assertEquals(new Double(25.0), service.getTemperature());
   service.setTemperature(10.0);
   assertEquals(new Double(10.0), service.getTemperature());
   service.setTemperature(27.0);
   assertEquals(new Double(27.0), service.getTemperature());
   service.setTemperature(21.00);
   assertEquals(new Double(21.0), service.getTemperature());
 }
コード例 #5
0
  @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);
  }