Abhitocode commented on code in PR #3649:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3649#discussion_r1737977858


##########
jbpm/jbpm-tests/src/test/java/org/jbpm/bpmn2/EscalationEventTest.java:
##########
@@ -181,12 +183,16 @@ public void testEscalationBoundaryEvent() {
     }
 
     @Test
-    public void testEscalationBoundaryEventInterrupting() throws Exception {
-        kruntime = 
createKogitoProcessRuntime("org/jbpm/bpmn2/escalation/BPMN2-EscalationBoundaryEventInterrupting.bpmn2");
-        TestWorkItemHandler handler = new TestWorkItemHandler();
-        kruntime.getKogitoWorkItemManager().registerWorkItemHandler("MyTask", 
handler);
-        KogitoProcessInstance processInstance = 
kruntime.startProcess("EscalationBoundaryEventInterrupting");
-        assertProcessInstanceCompleted(processInstance);
+    public void testEscalationBoundaryEventInterrupting() {
+        Application app = ProcessTestHelper.newApplication();
+        ProcessTestHelper.registerHandler(app, "MyTask", new 
TestWorkItemHandler());
+        
org.kie.kogito.process.Process<EscalationBoundaryEventInterruptingModel> 
processDefinition = EscalationBoundaryEventInterruptingProcess.newProcess(app);
+        EscalationBoundaryEventInterruptingModel model = 
processDefinition.createModel();
+        
org.kie.kogito.process.ProcessInstance<EscalationBoundaryEventInterruptingModel>
 instance = processDefinition.createInstance(model);
+        instance.start();
+        instance.workItems().forEach(workItem -> 
instance.completeWorkItem(workItem.getId(), null));

Review Comment:
   yes you're right, when i faced an error before, i think i misunderstood it 
and used manual process.
   I checked upon it again, I think  MyTask in subprocess is not completing 
successfully preventing the process to be in completed state also the 
TestWorkItemHandler does not mark work item to be completed  resulting in the 
process to be active state.
   
   ```
   @Test
       public void testEscalationBoundaryEventInterrupting() {
           Application app = ProcessTestHelper.newApplication();
           ProcessTestHelper.registerHandler(app, "MyTask", new 
TestWorkItemHandler());
           
org.kie.kogito.process.Process<EscalationBoundaryEventInterruptingModel> 
processDefinition = EscalationBoundaryEventInterruptingProcess.newProcess(app);
           EscalationBoundaryEventInterruptingModel model = 
processDefinition.createModel();
           
org.kie.kogito.process.ProcessInstance<EscalationBoundaryEventInterruptingModel>
 instance = processDefinition.createInstance(model);
           instance.start();
           
assertThat(instance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED);
       }
       
   ```
   Escalation handled
   org.opentest4j.AssertionFailedError: 
   expected: 2
    but was: 1
   Expected :2
   Actual   :1
   
   Will remove it from this pr and add it in the pr related to test issues.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to