@Test
public void testCancelWithoutWorkflowId() {

    WorkflowDef workflowDef = new WorkflowDef();
    Workflow workflowInstance = new Workflow();
    Workflow subWorkflowInstance = new Workflow();
    workflowInstance.setWorkflowDefinition(workflowDef);
    Task task = new Task();
    Map<String, Object> outputData = new HashMap<>();
    task.setOutputData(outputData);
    Map<String, Object> inputData = new HashMap<>();
    inputData.put("subWorkflowName", "UnitWorkFlow");
    inputData.put("subWorkflowVersion", 2);
    task.setInputData(inputData);
    when(workflowExecutor.startWorkflow(eq("UnitWorkFlow"), eq(2), eq(inputData), eq(null), any(), any(), any(), eq(null), eq(null)))
            .thenReturn("workflow_1");
    when(workflowExecutor.getWorkflow(eq("sub-workflow-id"), eq(false)))
            .thenReturn(subWorkflowInstance);
    subWorkflow.cancel(workflowInstance, task, workflowExecutor);
    assertEquals(Workflow.WorkflowStatus.RUNNING, subWorkflowInstance.getStatus());
}