use of org.drools.workbench.screens.scenariosimulation.client.handlers.CloseCompositeEventHandler in project drools-wb by kiegroup.
the class CollectionEditorSingletonDOMElementFactoryTest method registerHandlers.
@Test
public void registerHandlers() {
CollectionEditorDOMElement collectionEditorDOMElementMock = mock(CollectionEditorDOMElement.class);
collectionEditorSingletonDOMElementFactorySpy.registerHandlers(collectionEditorViewImpl, collectionEditorDOMElementMock);
ArgumentCaptor<CloseCompositeEventHandler> closeHandler = ArgumentCaptor.forClass(CloseCompositeEventHandler.class);
verify(collectionEditorViewImpl, times(1)).addCloseCompositeEventHandler(closeHandler.capture());
closeHandler.getValue().onEvent(mock(CloseCompositeEvent.class));
verify(collectionEditorSingletonDOMElementFactorySpy).destroyResources();
verify(scenarioGridLayerMock).batch();
verify(scenarioGridPanelMock).setFocus(eq(true));
verify(collectionEditorDOMElementMock).stopEditingMode();
reset(collectionEditorSingletonDOMElementFactorySpy);
reset(scenarioGridLayerMock);
reset(scenarioGridPanelMock);
ArgumentCaptor<SaveEditorEventHandler> saveHandler = ArgumentCaptor.forClass(SaveEditorEventHandler.class);
verify(collectionEditorViewImpl, times(1)).addSaveEditorEventHandler(saveHandler.capture());
saveHandler.getValue().onEvent(mock(SaveEditorEvent.class));
verify(collectionEditorSingletonDOMElementFactorySpy).flush();
verify(scenarioGridLayerMock).batch();
verify(scenarioGridPanelMock).setFocus(eq(true));
}
Aggregations