OptaPlannerWorkbenchEntryPoint extends DefaultWorkbenchEntryPoint { @Override protected void setupMenu() { adminPage.addScreen("root", translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_Settings)); adminPage.setDefaultScreen("root"); adminPage.addPreference("root", "LibraryPreferences", translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_Library), new Sets.Builder().add("fa").add("fa-cubes").build(), "preferences"); adminPage.addPreference("root", "ArtifactRepositoryPreference", translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_ArtifactRepository), new Sets.Builder().add("fa").add("fa-archive").build(), "preferences"); adminPage.addTool("root", translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_SSHKeyStore), new Sets.Builder().add("fa").add("fa-key").build(), "general", () -> { final Command accessSSHKeysEditor = () -> placeManager.goTo(PerspectiveIds.SSH_KEYS_EDITOR); accessSSHKeysEditor.execute(); }); menusHelper.addRolesMenuItems(); menusHelper.addUtilitiesMenuItems(); final Menus menus = MenuFactory .newTopLevelMenu(translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_Home)) .withItems(getHomePerspectives()) .endMenu() .newTopLevelMenu(translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_Authoring)) .withItems(getAuthoringPerspectives()) .endMenu() .newTopLevelMenu(translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_Deploy)) .withItems(getDeployPerspectives()) .endMenu() .build(); menuBar.addMenus(menus); } @Inject  OptaPlannerWorkbenchEntryPoint(final Caller<AppConfigService> appConfigService,
                                          final ActivityBeansCache activityBeansCache,
                                          final DefaultWorkbenchFeaturesMenusHelper menusHelper,
                                          final WorkbenchMegaMenuPresenter menuBar,
                                          final UserMenu userMenu,
                                          final AdminPage adminPage,
                                          final TranslationService translationService,
                                          final DefaultWorkbenchErrorCallback defaultWorkbenchErrorCallback,
                                          final PlaceManager placeManager,
                                          final AppFormerJsBridge appFormerJsBridge);   }
@Test public void setupMenu() { when(translationService.getTranslation(anyString())).thenReturn("translation"); when(translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_Home)).thenReturn("Home"); when(translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_Authoring)).thenReturn("Authoring"); when(translationService.getTranslation(AppConstants.OptaPlannerWorkbenchEntryPoint_Deploy)).thenReturn("Deploy"); optaPlannerWorkbenchEntryPoint.setupMenu(); ArgumentCaptor<Menus> menusCaptor = ArgumentCaptor.forClass(Menus.class); verify(menuBar).addMenus(menusCaptor.capture()); Menus menus = menusCaptor.getValue(); assertEquals(3, menus.getItems().size()); assertEquals("Home", menus.getItems().get(0).getCaption()); assertEquals("Authoring", menus.getItems().get(1).getCaption()); assertEquals("Deploy", menus.getItems().get(2).getCaption()); verify(menusHelper).addRolesMenuItems(); verify(menusHelper).addUtilitiesMenuItems(); verifyAdminPage(); }