Skip to content

Commit f5b798c

Browse files
committed
Update unit tests for voice commands lists
1 parent 54fa806 commit f5b798c

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,26 @@ public void testClearingMenu(){
469469
}
470470

471471
public void testSettingMenuWithEmptyVoiceCommands(){
472+
// Make sure we can send an empty menu with no issues
473+
// start fresh
474+
menuManager.oldMenuCells = null;
475+
menuManager.menuCells = null;
476+
menuManager.inProgressUpdate = null;
477+
menuManager.waitingUpdateMenuCells = null;
478+
menuManager.waitingOnHMIUpdate = false;
479+
480+
MenuSelectionListener menuSelectionListener = mock(MenuSelectionListener.class);
472481

482+
MenuCell A = new MenuCell("A", null, Collections.EMPTY_LIST, menuSelectionListener);
483+
484+
menuManager.currentHMILevel = HMILevel.HMI_FULL;
485+
List<MenuCell> newMenu = Collections.singletonList(A);
486+
487+
menuManager.setMenuCells(newMenu);
488+
assertEquals(menuManager.menuCells.get(0).getVoiceCommands(), Collections.EMPTY_LIST);
489+
}
490+
491+
public void testSettingMenuWithVoiceCommands(){
473492
// Make sure we can send an empty menu with no issues
474493
// start fresh
475494
menuManager.oldMenuCells = null;
@@ -481,17 +500,15 @@ public void testSettingMenuWithEmptyVoiceCommands(){
481500

482501
MenuSelectionListener menuSelectionListener = mock(MenuSelectionListener.class);
483502

484-
MenuCell A = new MenuCell("A", null, Collections.EMPTY_LIST, menuSelectionListener);
503+
List<String> voiceCommandList = Collections.singletonList("Hello There");
504+
505+
MenuCell A = new MenuCell("A", null, voiceCommandList, menuSelectionListener);
485506

486507
menuManager.currentHMILevel = HMILevel.HMI_FULL;
487-
// send new cells. They should set the old way
488-
List<MenuCell> oldMenu = createDynamicMenu1();
489508
List<MenuCell> newMenu = Collections.singletonList(A);
490-
menuManager.setMenuCells(oldMenu);
491-
assertEquals(menuManager.menuCells.size(), 4);
492509

493510
menuManager.setMenuCells(newMenu);
494-
assertEquals(menuManager.menuCells.size(), 1);
511+
assertEquals(menuManager.menuCells.get(0).getVoiceCommands(), voiceCommandList);
495512
}
496513

497514

0 commit comments

Comments
 (0)