@Test
public void testDynamicNodeValidationInNotDynamicProcess() throws Exception {

    RuleFlowProcess process = new RuleFlowProcess();
    process.setId("org.drools.core.process");
    process.setName("Dynamic Node Process");
    process.setPackageName("org.mycomp.myprocess");
    process.setDynamic(false);
    DynamicNode dynamicNode = new DynamicNode();
    dynamicNode.setName("MyDynamicNode");
    dynamicNode.setId(1);
    dynamicNode.setAutoComplete(false);
    // empty completion expression to trigger validation error
    dynamicNode.setCompletionExpression("");
    process.addNode(dynamicNode);
    ProcessValidationError[] errors = validator.validateProcess(process);
    assertNotNull(errors);
    // in non-dynamic processes all check should be triggered
    // they should also include process level checks (start node, end node etc)
    assertEquals(6,
                 errors.length);
    assertEquals("Process has no start node.",
                 errors[0].getMessage());
    assertEquals("Process has no end node.",
                 errors[1].getMessage());
    assertEquals("Node 'MyDynamicNode' [1] Dynamic has no incoming connection",
                 errors[2].getMessage());
    assertEquals("Node 'MyDynamicNode' [1] Dynamic has no outgoing connection",
                 errors[3].getMessage());
    assertEquals("Node 'MyDynamicNode' [1] Dynamic has no completion condition set",
                 errors[4].getMessage());
    assertEquals("Node 'MyDynamicNode' [1] Has no connection to the start node.",
                 errors[5].getMessage());
}