use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ActionSetFactPluginTest method patternWrapperMock.
private PatternWrapper patternWrapperMock(final String factType, final String boundName) {
final PatternWrapper patternWrapper = mock(PatternWrapper.class);
doReturn(factType).when(patternWrapper).getFactType();
doReturn(boundName).when(patternWrapper).getBoundName();
return patternWrapper;
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldPluginTest method testNewPatternWrapperWhenPatternIsNotFound.
@Test
public void testNewPatternWrapperWhenPatternIsNotFound() throws Exception {
final Set<PatternWrapper> actionWrappers = new HashSet<>();
final ActionWorkItemWrapper actionWrapper = mockActionWrapper("BoundName", "FactType");
doReturn(actionWrappers).when(plugin).getPatterns();
final PatternWrapper patternWrapper = plugin.newPatternWrapper(actionWrapper);
assertEquals(actionWrapper.getBoundName(), patternWrapper.getBoundName());
assertEquals(actionWrapper.getFactType(), patternWrapper.getFactType());
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldPluginTest method testSetFactFieldWhenFactPattern.
@Test
public void testSetFactFieldWhenFactPattern() throws Exception {
final PatternWrapper patternWrapper = mock(PatternWrapper.class);
final String factField = "factField";
final String factType = "factType";
final String boundName = "boundName";
final String type = "type";
doReturn(factType).when(patternWrapper).getFactType();
doReturn(boundName).when(patternWrapper).getBoundName();
doReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY).when(model).getTableFormat();
doReturn(editingWrapper).when(plugin).editingWrapper();
doReturn(patternWrapper).when(plugin).patternWrapper();
doReturn(model).when(presenter).getModel();
doReturn(oracle).when(presenter).getDataModelOracle();
doReturn(true).when(plugin).isNewFactPattern();
doReturn(type).when(oracle).getFieldType(any(), any());
plugin.setFactField(factField);
verify(editingWrapper).setFactField(factField);
verify(editingWrapper).setFactType(factType);
verify(editingWrapper).setBoundName(boundName);
verify(editingWrapper).setType(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 ActionWorkItemSetFieldPluginTest method testNewPatternWrapperWhenPatternIsFound.
@Test
public void testNewPatternWrapperWhenPatternIsFound() throws Exception {
final PatternWrapper expectedWrapper = mockPatternWrapper("BoundName");
final Set<PatternWrapper> actionWrappers = new HashSet<PatternWrapper>() {
{
add(expectedWrapper);
}
};
doReturn(actionWrappers).when(plugin).getPatterns();
final PatternWrapper actualWrapper = plugin.newPatternWrapper(mockActionWrapper("BoundName", "factType"));
assertSame(expectedWrapper, actualWrapper);
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldPluginTest method testIsNewFactPatternWhenIsNew.
@Test
public void testIsNewFactPatternWhenIsNew() throws Exception {
mockPatterns();
plugin.setEditingPattern(new PatternWrapper("factType", "bananna"));
assertTrue(plugin.isNewFactPattern());
}
Aggregations