use of org.drools.workbench.screens.enums.model.EnumModelContent in project drools-wb by kiegroup.
the class EnumEditorPresenterTest method setup.
@Before
public void setup() {
// Mock EnumResourceType
this.type = GWT.create(EnumResourceType.class);
// Mock FileMenuBuilder usage since we cannot use FileMenuBuilderImpl either
when(mockFileMenuBuilder.addSave(any(MenuItem.class))).thenReturn(mockFileMenuBuilder);
when(mockFileMenuBuilder.addCopy(any(ObservablePath.class), any(DefaultFileNameValidator.class))).thenReturn(mockFileMenuBuilder);
when(mockFileMenuBuilder.addRename(any(Command.class))).thenReturn(mockFileMenuBuilder);
when(mockFileMenuBuilder.addDelete(any(ObservablePath.class))).thenReturn(mockFileMenuBuilder);
when(mockFileMenuBuilder.addValidate(any(Command.class))).thenReturn(mockFileMenuBuilder);
when(mockFileMenuBuilder.addNewTopLevelMenu(any(MenuItem.class))).thenReturn(mockFileMenuBuilder);
when(mockVersionRecordManager.getCurrentPath()).thenReturn(path);
when(mockVersionRecordManager.getPathToLatest()).thenReturn(path);
when(mockWorkbenchContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
this.model = new EnumModel("'Fact.field' : ['a', 'b']");
this.content = new EnumModelContent(model, overview);
when(enumService.loadContent(path)).thenReturn(content);
when(view.getContent()).thenReturn(new ArrayList<EnumRow>() {
{
add(new EnumRow("Fact", "field", "['a', 'b']"));
}
});
this.enumServiceCaller = new CallerMock<EnumService>(enumService);
this.presenter = new EnumEditorPresenter(view, enumServiceCaller, type, validationPopup) {
{
// Yuck, yuck, yuck... the class hierarchy is really a mess
this.kieView = mockKieView;
this.overviewWidget = mockOverviewWidget;
this.fileMenuBuilder = mockFileMenuBuilder;
this.fileNameValidator = mockFileNameValidator;
this.versionRecordManager = mockVersionRecordManager;
this.notification = mockNotification;
this.workbenchContext = mockWorkbenchContext;
this.saveAndRenameCommandBuilder = mockSaveAndRenameCommandBuilder;
this.alertsButtonMenuItemBuilder = mockAlertsButtonMenuItemBuilder;
}
@Override
protected Command getSaveAndRename() {
return mock(Command.class);
}
};
}
Aggregations