예제 #1
0
  @UseDataProvider("pronunciation")
  @Test
  public void should_treat_voice_pronunciation_attribute(String pronunciation) {
    // given
    TestDummy device = new TestDummy("lampe");
    device.getSetList().parse("on off");
    device.setPronunciation(pronunciation);
    RoomDeviceList deviceList = new RoomDeviceList("").addDevice(device, context);
    doReturn(deviceList)
        .when(roomListService)
        .getAllRoomsDeviceList(Optional.<String>absent(), context);

    // when
    Optional<VoiceResult> result = service.resultFor("set " + pronunciation + " on", context);

    // then
    assertThat(result).contains(new VoiceResult.Success("lampe", "on"));
  }
예제 #2
0
  @Test
  @UseDataProvider("shortcutCommandsForDevice")
  public void should_handle_shortcuts(CommandTestCase commandTestCase) {
    // given
    TestDummy device = new TestDummy(commandTestCase.deviceName);
    device.setPronunciation("garten leuchte");
    device.getSetList().parse("on off");
    RoomDeviceList deviceList = new RoomDeviceList("").addDevice(device, context);
    doReturn(deviceList)
        .when(roomListService)
        .getAllRoomsDeviceList(Optional.<String>absent(), context);

    // when
    Optional<VoiceResult> result = service.resultFor(commandTestCase.command, context);

    // then
    assertThat(result).contains(commandTestCase.voiceResult);
  }