use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ConditionColumnPluginTest method testMakeBRLRuleModel.
@Test
public void testMakeBRLRuleModel() {
final String factType = "FactType";
final String boundName1 = "$fact1";
final String boundName2 = "$fact2";
final Pattern52 pattern = new Pattern52() {
{
setFactType(factType);
setBoundName(boundName1);
}
};
final FactPattern factPattern = new FactPattern() {
{
setFactType(factType);
setBoundName(boundName2);
}
};
final PatternWrapper patternWrapper = mock(PatternWrapper.class);
doReturn(factPattern).when(patternWrapper).makeFactPattern();
doReturn(patternWrapper).when(plugin).patternWrapper();
doReturn(Collections.singletonList(pattern)).when(model).getConditions();
doReturn(pattern).when(model).getConditionPattern(boundName1);
final BRLRuleModel brlRuleModel = plugin.makeBRLRuleModel();
final List<String> expectedVariables = Arrays.asList(boundName1, boundName2);
final List<String> actualVariables = brlRuleModel.getAllVariables();
assertEquals(expectedVariables, actualVariables);
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ConditionColumnPluginTest method testGetEntryPointNameWhenEditingPatternIsNotNull.
@Test
public void testGetEntryPointNameWhenEditingPatternIsNotNull() throws Exception {
final PatternWrapper pattern = mock(PatternWrapper.class);
doReturn("EntryPointName").when(pattern).getEntryPointName();
doReturn(pattern).when(plugin).patternWrapper();
final String entryPointName = plugin.getEntryPointName();
assertEquals("EntryPointName", entryPointName);
}
Aggregations