Skip to content

Commit d5da8a0

Browse files
author
Julian Kast
committed
Add unit test for voiceCommands
1 parent 97ec0c3 commit d5da8a0

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/VoiceCommandUpdateOperationTests.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,29 @@ public void updateVoiceCommands(List<VoiceCommand> newCurrentVoiceCommands, Hash
294294

295295
verify(listenerSpy, times(1)).updateVoiceCommands(any(List.class), any(HashMap.class));
296296
}
297+
298+
299+
300+
@Test
301+
public void testVoiceCommandsInListNotInSecondList() {
302+
VoiceCommand command1 = new VoiceCommand(Collections.singletonList("Command 1"), null);
303+
VoiceCommand command2 = new VoiceCommand(Collections.singletonList("Command 2"), null);
304+
VoiceCommand command3 = new VoiceCommand(Collections.singletonList("Command 3"), null);
305+
306+
VoiceCommand command1Clone = new VoiceCommand(Collections.singletonList("Command 1"), null);
307+
308+
List<VoiceCommand> voiceCommandList = new ArrayList<>();
309+
voiceCommandList.add(command1);
310+
voiceCommandList.add(command2);
311+
312+
List<VoiceCommand> voiceCommandList2 = new ArrayList<>();
313+
voiceCommandList2.add(command1Clone);
314+
voiceCommandList2.add(command3);
315+
VoiceCommandUpdateOperation voiceCommandUpdateOperation = new VoiceCommandUpdateOperation(internalInterface,null,null,null);
316+
317+
List<VoiceCommand> differencesList = voiceCommandUpdateOperation.voiceCommandsInListNotInSecondList(voiceCommandList, voiceCommandList2);
318+
assertEquals(differencesList.size(), 1);
319+
320+
}
321+
297322
}

0 commit comments

Comments
 (0)