AdminPagePresenter { public void init(final String screen) { this.screen = screen; final Map<String, List<AdminTool>> toolsByCategory = adminPage.getToolsByCategory(screen); if (toolsByCategory != null) { toolsByCategory.forEach((category, adminTools) -> { AdminPageCategoryPresenter categoryPresenter = categoryPresenterProvider.get(); categoryPresenter.setup(adminTools, screen, perspectiveIdentifierToGoBackTo); view.add(categoryPresenter.getView()); }); } else { notification.fire(new NotificationEvent(view.getNoScreenFoundError(screen), NotificationEvent.NotificationType.ERROR)); } } @Inject  AdminPagePresenter(final View view,
                              final AdminPage adminPage,
                              final ManagedInstance<AdminPageCategoryPresenter> categoryPresenterProvider,
                              final Event<NotificationEvent> notification); @OnStartup void onStartup(final PlaceRequest placeRequest); void init(final String screen); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView View getView(); AdminPage getAdminPage(); String getScreen(); static final String IDENTIFIER; }
@Test public void initWithNotAddedScreenTest() { presenter.init("not-added-screen"); verify(notification).fire(any(NotificationEvent.class)); }
@Test public void initWithAddedScreenTest() { adminPage.addScreen("added-screen", "Screen title"); presenter.init("added-screen"); verify(notification, never()).fire(any(NotificationEvent.class)); }