@Test
public void testScriptAndWorkItemGeneration() {

    RuleFlowProcessFactory factory = RuleFlowProcessFactory.createProcess("demo.orders");
    factory
        .variable("order", new ObjectDataType("com.myspace.demo.Order"))
        .variable("approver", new ObjectDataType("String"))
        .name("orders")
        .packageName("com.myspace.demo")
        .dynamic(false)
        .version("1.0")
    .workItemNode(1)
        .name("Log")
        .workName("Log")
        .done()
    .actionNode(2)
        .name("Dump order")
        .action("java", "System.out.println(\"Order has been created \" + order);")
        .done()
    .endNode(3)
        .name("end")
        .terminate(false)
        .done()
    .startNode(4)
        .name("start")
        .done()
    .connection(2, 1)
    .connection(4, 2)
    .connection(1, 3);
    
    WorkflowProcess process = factory.validate().getProcess();
    
    ProcessMetaData processMetadata = ProcessToExecModelGenerator.INSTANCE.generate(process);
    assertNotNull(processMetadata, "Dumper should return non null class for process");
    
    logger.debug(processMetadata.getGeneratedClassModel().toString());
    
    assertEquals("orders", processMetadata.getExtractedProcessId());
    assertEquals("demo.orders", processMetadata.getProcessId());
    assertEquals("orders", processMetadata.getProcessName());
    assertEquals("1.0", processMetadata.getProcessVersion());
    assertEquals("com.myspace.demo.OrdersProcess", processMetadata.getProcessClassName());
    assertNotNull(processMetadata.getGeneratedClassModel());
    assertEquals(1, processMetadata.getWorkItems().size());
}