Search in sources :

Example 21 with Section

use of org.kie.workbench.common.screens.library.client.settings.SettingsPresenter.Section in project kie-wb-common by kiegroup.

the class SettingsPresenterTest method testSave.

@Test
public void testSave() {
    WorkspaceProject project = mock(WorkspaceProject.class);
    doReturn(project).when(projectScreenService).save(any(), any(), any(), any());
    final Section section1 = newMockedSection();
    final Section section2 = newMockedSection();
    doReturn(promises.resolve()).when(settingsPresenter).resetDirtyIndicator(eq(section1));
    doReturn(promises.resolve()).when(settingsPresenter).resetDirtyIndicator(eq(section2));
    settingsPresenter.sections = new ArrayList<>(Arrays.asList(section1, section2));
    settingsPresenter.save("Test comment");
    verify(section1).save(eq("Test comment"), any());
    verify(section2).save(eq("Test comment"), any());
    verify(settingsPresenter).saveProjectScreenModel(eq("Test comment"), eq(DeploymentMode.VALIDATED), any());
    verify(settingsPresenter).resetDirtyIndicator(eq(section1));
    verify(settingsPresenter).resetDirtyIndicator(eq(section2));
    verify(settingsPresenter).displaySuccessMessage();
}
Also used : WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) Section(org.kie.workbench.common.screens.library.client.settings.SettingsPresenter.Section) Test(org.junit.Test)

Aggregations

Section (org.kie.workbench.common.screens.library.client.settings.SettingsPresenter.Section)21 Test (org.junit.Test)20 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)1 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)1