Commit cf60b609 authored by cijujoseph's avatar cijujoseph

added documentation

parent b08c7a9e
......@@ -15,14 +15,20 @@ import com.alfresco.aps.testutils.AbstractDmnTest;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:activiti.dmn.cfg.xml" })
public class DmnUnitTest extends AbstractDmnTest {
static {
appName = "Test App";
decisonTableKey = "dmntest";
}
/*
* Test a successful hit using all possible inputs
*/
@Test
public void testDMNExecution() throws Exception {
/*
* Invoke with input set to xyz and assert output is equal to abc
*/
Map<String, Object> processVariablesInput = new HashMap<>();
processVariablesInput.put("input", "xyz");
RuleEngineExecutionResult result = ruleService.executeDecisionByKey(decisonTableKey, processVariablesInput);
......@@ -30,14 +36,20 @@ public class DmnUnitTest extends AbstractDmnTest {
Assert.assertEquals(1, result.getResultVariables().size());
Assert.assertSame(result.getResultVariables().get("output").getClass(), String.class);
Assert.assertEquals(result.getResultVariables().get("output"), "abc");
/*
* Invoke with input set to 123 and assert output is equal to abc
*/
processVariablesInput.put("input", "123");
result = ruleService.executeDecisionByKey(decisonTableKey, processVariablesInput);
Assert.assertNotNull(result);
Assert.assertEquals(1, result.getResultVariables().size());
Assert.assertSame(result.getResultVariables().get("output").getClass(), String.class);
Assert.assertEquals(result.getResultVariables().get("output"), "abc");
/*
* Invoke with input set to abc and assert output is equal to abc
*/
processVariablesInput.put("input", "abc");
result = ruleService.executeDecisionByKey(decisonTableKey, processVariablesInput);
Assert.assertNotNull(result);
......@@ -45,7 +57,10 @@ public class DmnUnitTest extends AbstractDmnTest {
Assert.assertSame(result.getResultVariables().get("output").getClass(), String.class);
Assert.assertEquals(result.getResultVariables().get("output"), "abc");
}
/*
* Test a miss
*/
@Test
public void testDMNExecutionNoMatch() throws Exception {
Map<String, Object> processVariablesInput = new HashMap<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment