use of org.uberfire.ext.editor.commons.version.events.RestoreEvent in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorPresenterTest method checkOnRestore.
@Test
public void checkOnRestore() {
final ObservablePath dtGraphPath = mock(ObservablePath.class);
final PathPlaceRequest dtGraphPlaceRequest = mock(PathPlaceRequest.class);
final GuidedDecisionTableEditorGraphContent dtGraphContent = makeDecisionTableGraphContent();
final RestoreEvent event = new RestoreEvent(dtGraphPath);
when(dtGraphPath.toURI()).thenReturn("dtGraphPath");
when(dtGraphPath.getFileName()).thenReturn("filename");
when(dtGraphService.loadContent(eq(dtGraphPath))).thenReturn(dtGraphContent);
when(versionRecordManager.getCurrentPath()).thenReturn(dtGraphPath);
when(versionRecordManager.getPathToLatest()).thenReturn(dtGraphPath);
presenter.onStartup(dtGraphPath, dtGraphPlaceRequest);
verify(presenter, times(1)).initialiseEditor(eq(dtGraphPath), eq(dtGraphPlaceRequest));
presenter.onRestore(event);
verify(presenter, times(2)).initialiseEditor(eq(dtGraphPath), eq(dtGraphPlaceRequest));
verify(notification, times(1)).fire(any(NotificationEvent.class));
}
Aggregations