### Question:
LibraryScreen { @PostConstruct public void init() { final OrganizationalUnit activeOU = projectContext.getActiveOrganizationalUnit() .orElseThrow(() -> new IllegalStateException("Cannot initialize library screen without an active organizational unit.")); view.init(this); view.setTitle(activeOU.getName()); view.setDescription(activeOU.getDescription()); view.showSettingsTab(organizationalUnitController.canUpdateOrgUnit(activeOU)); showProjects(); contributorsListPresenter.setup(spaceContributorsListService, contributorsCount -> view.setContributorsCount(contributorsCount)); } @Inject  LibraryScreen(final View view,
                         final ManagedInstance<DeleteOrganizationalUnitPopUpPresenter> deleteOrganizationalUnitPopUpPresenters,
                         final WorkspaceProjectContext projectContext,
                         final ProjectController projectController,
                         final OrganizationalUnitController organizationalUnitController,
                         final EmptyLibraryScreen emptyLibraryScreen,
                         final PopulatedLibraryScreen populatedLibraryScreen,
                         final OrgUnitsMetricsScreen orgUnitsMetricsScreen,
                         final SettingsScreenPresenter settingsScreenPresenter,
                         final ContributorsListPresenter contributorsListPresenter,
                         final Caller<LibraryService> libraryService,
                         final Caller<OrganizationalUnitService> organizationalUnitService,
                         final LibraryPlaces libraryPlaces,
                         final SpaceContributorsListServiceImpl spaceContributorsListService,
                         final Event<NotificationEvent> notificationEvent,
                         final TranslationService translationService,
                         final Promises promises); @PostConstruct void init(); void trySamples(); void importProject(); void delete(); void showProjects(); void showContributors(); void showMetrics(); void showSettings(); boolean userCanCreateProjects(); boolean userCanUpdateOrganizationalUnit(); boolean userCanDeleteOrganizationalUnit(); void onNewProject(@Observes NewProjectEvent e); void onRepositoryRemovedEvent(@Observes RepositoryRemovedEvent e); void onProjectCountUpdate(@Observes final ProjectCountUpdate projectCountUpdate); void onSpaceContributorsUpdated(@Observes final SpaceContributorsUpdatedEvent spaceContributorsUpdatedEvent); @OnClose void onClose(); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView View getView();  }### Answer:
@Test public void setupTest() { when(view.isProjectsTabActive()).thenReturn(true); final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class); doReturn("name").when(organizationalUnit).getName(); doReturn(Optional.of(organizationalUnit)).when(projectContext).getActiveOrganizationalUnit(); libraryScreen.init(); verify(view).init(libraryScreen); verify(view).setTitle("name"); verify(contributorsListPresenter).setup(eq(spaceContributorsListService), any()); verify(view).setProjectsCount(0); verify(view).isProjectsTabActive(); verify(view).updateContent(any()); }
@Test public void showSettingsTabWhenUserAllowed() { libraryScreen.init(); verify(view).showSettingsTab(true); }
@Test public void hideSettingsTabWhenUserNotAllowed() { doReturn(false).when(organizationalUnitController).canUpdateOrgUnit(any()); libraryScreen.init(); verify(view).showSettingsTab(false); }