use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class PatternPageTest method testSetSelectedEditingPattern.
@Test
public void testSetSelectedEditingPattern() throws Exception {
final PatternWrapper patternWrapper = mock(PatternWrapper.class);
final String key = "factType boundName false";
when(page.findPatternWrapperByKey(key)).thenReturn(patternWrapper);
when(view.getSelectedValue()).thenReturn(key);
page.setSelectedEditingPattern();
verify(page).setEditingPattern(patternWrapper);
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class NewPatternPresenterTest method testAddPatternWhenPatternIsValid.
@Test
public void testAddPatternWhenPatternIsValid() throws Exception {
final PatternWrapper pattern52 = mock(PatternWrapper.class);
doReturn("Applicant").when(view).getSelectedFactType();
doReturn("app").when(view).getBindingText();
doReturn(false).when(view).isNegatePatternMatch();
doReturn(pattern52).when(presenter).pattern52();
presenter.addPattern();
verify(patternPage).setEditingPattern(pattern52);
verify(patternPage).prepareView();
verify(view).hide();
verify(view, never()).showError(any());
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class NewPatternPresenterTest method testPattern52.
@Test
public void testPattern52() throws Exception {
when(view.getSelectedFactType()).thenReturn("Applicant");
when(view.getBindingText()).thenReturn("app");
when(view.isNegatePatternMatch()).thenReturn(false);
final PatternWrapper pattern52 = presenter.pattern52();
assertEquals("Applicant", pattern52.getFactType());
assertEquals("app", pattern52.getBoundName());
assertEquals(false, pattern52.isNegated());
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ActionSetFactPluginTest method testSetFactFieldWhenFactPatternIsNotNew.
@Test
public void testSetFactFieldWhenFactPatternIsNotNew() {
final ActionSetFactWrapper actionWrapper = spy(new ActionSetFactWrapper(plugin));
final Pattern52 patternMock = patternMock("factType");
final PatternWrapper patternWrapperMock = patternWrapperMock("factType", "boundName");
doReturn(false).when(plugin).isNewFactPattern();
doReturn(actionWrapper).when(plugin).newActionSetFactWrapper();
doReturn(patternWrapperMock).when(plugin).patternWrapper();
doReturn(patternMock).when(model).getConditionPattern(eq("boundName"));
doReturn("type").when(oracle).getFieldType(eq("factType"), eq("selectedValue"));
plugin.setFactField("selectedValue");
verify(actionWrapper).setFactField(eq("selectedValue"));
verify(actionWrapper).setFactType(eq("factType"));
verify(actionWrapper).setBoundName(eq("boundName"));
verify(actionWrapper).setType(eq("type"));
verify(plugin).fireChangeEvent(fieldPage);
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ActionSetFactPluginTest method mockPatternWrapper.
private PatternWrapper mockPatternWrapper(final String boundName) {
final PatternWrapper wrapper = mock(PatternWrapper.class);
when(wrapper.getBoundName()).thenReturn(boundName);
return wrapper;
}
Aggregations