AdminPageImpl implements AdminPage { @Override public void addPreference(final String screen, final String identifier, final String title, final Set<String> iconCss, final String category, final AdminPageOptions... options) { addPreference(screen, identifier, title, iconCss, category, (Supplier<PreferenceScopeResolutionStrategyInfo>) null, options); } AdminPageImpl(); @Inject  AdminPageImpl(final PlaceManager placeManager,
                         final Event<PreferencesCentralInitializationEvent> preferencesCentralInitializationEvent,
                         @Customizable final PreferenceScopeResolutionStrategy resolutionStrategy,
                         final UberfireBreadcrumbs breadcrumbs,
                         final TranslationService translationService); @Override void addScreen(final String identifier,
                          final String title); @Override void addTool(final String screen,
                        final String title,
                        final Set<String> iconCss,
                        final String category,
                        final Command command,
                        final ParameterizedCommand<ParameterizedCommand<Integer>> counterCommand); @Override void addTool(final String screen,
                        final String title,
                        final Set<String> iconCss,
                        final String category,
                        final Command command); @Override void addPreference(final String screen,
                              final String identifier,
                              final String title,
                              final Set<String> iconCss,
                              final String category,
                              final AdminPageOptions... options); @Override void addPreference(final String screen,
                              final String identifier,
                              final String title,
                              final Set<String> iconCss,
                              final String category,
                              final Supplier<PreferenceScopeResolutionStrategyInfo> customScopeResolutionStrategySupplier,
                              final AdminPageOptions... options); @Override void addPreference(final String screen,
                              final String identifier,
                              final String title,
                              final Set<String> iconCss,
                              final String category,
                              final PreferenceScope preferenceScope,
                              final AdminPageOptions... options); @Override void addPreference(final String screen,
                              final String identifier,
                              final String title,
                              final Set<String> iconCss,
                              final String category,
                              final Supplier<PreferenceScopeResolutionStrategyInfo> customScopeResolutionStrategySupplier,
                              final PreferenceScope preferenceScope,
                              final AdminPageOptions... options); @Override Map<String, List<AdminTool>> getToolsByCategory(final String screen); @Override String getScreenTitle(final String screen); @Override String getDefaultScreen(); @Override void setDefaultScreen(final String defaultScreen);  }
@Test public void addPreferenceTest() { adminPage.addScreen("screen1", "Screen 1"); adminPage.addPreference("screen1", "MyPreference", "My Preference", Sets.newHashSet("fa", "fa-map"), "category1"); final Map<String, List<AdminTool>> toolsByCategory1 = adminPage.getToolsByCategory("screen1"); assertNotNull(toolsByCategory1); assertEquals(1, toolsByCategory1.size()); final List<AdminTool> category1Tools = toolsByCategory1.get("category1"); assertEquals(1, category1Tools.size()); assertEquals("My Preference", category1Tools.get(0).getTitle()); assertEquals(2, category1Tools.get(0).getIconCss().size()); assertThat(category1Tools.get(0).getIconCss(), hasItems("fa", "fa-map")); category1Tools.get(0).getOnClickCommand().execute(); verify(placeManager).goTo(eq(new DefaultPlaceRequest(PreferencesCentralPerspective.IDENTIFIER))); verify(preferencesCentralInitializationEvent).fire(eq(new PreferencesCentralInitializationEvent("MyPreference", null, null))); }