GuidedRuleTemplateEditorPresenter extends KieEditor<TemplateModel> { protected void loadContent() { view.showLoading(); getService().call(getModelSuccessCallback(), getNoSuchFileExceptionErrorCallback()).loadContent(versionRecordManager.getCurrentPath()); } @Inject  GuidedRuleTemplateEditorPresenter(final GuidedRuleTemplateEditorView baseView); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); void handleImportAddedEvent(@Observes ImportAddedEvent event); void handleImportRemovedEvent(@Observes ImportRemovedEvent event); @Override void onSourceTabSelected(); @OnClose @Override void onClose(); @OnMayClose boolean mayClose(); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartTitleDecoration IsWidget getTitle(); @WorkbenchPartView IsWidget getWidget(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); static final String EDITOR_ID; }
@Test public void testLoadContentSuccess() throws Exception { doReturn(content).when(service).loadContent(eq(path)); presenter.loadContent(); verify(view).setContent(eq(templateModel), eq(oracle), any(), notNull(EventBus.class), eq(false)); final Imports imports = templateModel.getImports(); verify(kieView).addImportsTab(eq(importsWidgetPresenter)); verify(importsWidgetPresenter).setContent(eq(oracle), same(imports), eq(false)); }
@Test public void testLoadContentFail() throws Exception { doThrow(new RuntimeException()).when(service).loadContent(eq(path)); presenter.loadContent(); verify(view, never()).setContent(any(TemplateModel.class), any(AsyncPackageDataModelOracle.class), any(Caller.class), any(EventBus.class), anyBoolean()); }