use of org.kie.workbench.common.screens.library.client.widgets.library.AddProjectButtonPresenter in project kie-wb-common by kiegroup.
the class PopulatedLibraryScreenTest method setup.
@Before
public void setup() {
libraryServiceCaller = new CallerMock<>(libraryService);
libraryScreen = spy(new PopulatedLibraryScreen(view, libraryPlaces, libraryServiceCaller, projectController, projectContext, tileWidgets, addProjectButtonPresenter, projectCountUpdateEvent));
doReturn(true).when(projectController).canCreateProjects(any());
project1 = mockProject(PROJECT_1);
project2 = mockProject(PROJECT_2);
project3 = mockProject(PROJECT_3);
final List<WorkspaceProject> projects = new ArrayList<>();
projects.add(project1);
projects.add(project2);
projects.add(project3);
when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(organizationalUnit));
when(projectContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
when(projectContext.getActiveModule()).thenReturn(Optional.empty());
when(projectContext.getActiveRepositoryRoot()).thenReturn(Optional.empty());
when(projectContext.getActivePackage()).thenReturn(Optional.empty());
final LibraryInfo libraryInfo = new LibraryInfo(projects);
doReturn(libraryInfo).when(libraryService).getLibraryInfo(organizationalUnit);
doReturn(mock(TileWidget.View.class)).when(tileWidget).getView();
when(tileWidgets.get()).thenAnswer((Answer<TileWidget<WorkspaceProject>>) invocationOnMock -> {
TileWidget tile = mock(TileWidget.class);
doReturn(mock(TileWidget.View.class)).when(tile).getView();
doAnswer((Answer<Void>) invocationOnMock1 -> {
when(tile.getContent()).thenReturn(invocationOnMock1.getArgument(0, WorkspaceProject.class));
return null;
}).when(tile).setContent(any());
return tile;
});
doReturn(mock(AddProjectButtonPresenter.View.class)).when(addProjectButtonPresenter).getView();
libraryScreen.setup();
}
Aggregations