@Test
  public void should_return_error_if_more_than_one_device_matches_a_command() {
    // given
    TestDummy device = new TestDummy("lampe1", "lampe");
    TestDummy device1 = new TestDummy("lampe2", "lampe");
    device.getSetList().parse("on off");
    device1.getSetList().parse("on off");
    RoomDeviceList deviceList =
        new RoomDeviceList("").addDevice(device, context).addDevice(device1, context);
    doReturn(deviceList)
        .when(roomListService)
        .getAllRoomsDeviceList(Optional.<String>absent(), context);

    // when
    Optional<VoiceResult> result = service.resultFor("schalte lampe 1", context);

    // then
    assertThat(result)
        .contains(new VoiceResult.Error(VoiceResult.ErrorType.MORE_THAN_ONE_DEVICE_MATCHES));
  }
  @Test
  public void should_ignore_devices_not_containing_the_target_state_in_the_setlist() {
    // given
    TestDummy device = new TestDummy("lampe");
    device.getSetList().parse("off");
    RoomDeviceList deviceList = new RoomDeviceList("").addDevice(device, context);
    doReturn(deviceList)
        .when(roomListService)
        .getAllRoomsDeviceList(Optional.<String>absent(), context);

    // when
    Optional<VoiceResult> result = service.resultFor("schalte lampe on", context);

    // then
    assertThat(result).contains(new VoiceResult.Error(VoiceResult.ErrorType.NO_DEVICE_MATCHED));
  }
  @Test
  public void should_handle_event_maps() {
    // given
    TestDummy device = new TestDummy("lampe");
    device.getSetList().parse("on off");
    device.setEventmap("on:hallo");
    RoomDeviceList deviceList = new RoomDeviceList("").addDevice(device, context);
    doReturn(deviceList)
        .when(roomListService)
        .getAllRoomsDeviceList(Optional.<String>absent(), context);

    // when
    Optional<VoiceResult> result = service.resultFor("schalte lampe hallo", context);

    // then
    assertThat(result).contains(new VoiceResult.Success("lampe", "on"));
  }
  @Test
  @UseDataProvider("voiceCommandsForDevice")
  public void should_find_out_correct_voice_result(CommandTestCase testCase) {
    // given
    TestDummy device = new TestDummy(testCase.deviceName);
    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(testCase.command, context);

    // then
    assertThat(result).contains(testCase.voiceResult);
  }
  @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"));
  }
  @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);
  }