public void verifySubWorkflowExecutions() throws IOException {
        WorkflowDef def = getWorkflowDef("/workflows/kitchensink.json");
        assertNotNull(def);

        WorkflowDef subWorkflowDef = getWorkflowDef("/workflows/PopulationMinMax.json");
        metadataClient.registerWorkflowDef(subWorkflowDef);

        WorkflowTestRequest testRequest = getWorkflowTestRequest(def);

        // The following are the dynamic tasks which are not present in the workflow definition but
        // are created by dynamic fork
        testRequest
                .getTaskRefToMockOutput()
                .put("_x_test_worker_0_0", List.of(new WorkflowTestRequest.TaskMock()));
        testRequest
                .getTaskRefToMockOutput()
                .put("_x_test_worker_0_1", List.of(new WorkflowTestRequest.TaskMock()));
        testRequest
                .getTaskRefToMockOutput()
                .put("_x_test_worker_0_2", List.of(new WorkflowTestRequest.TaskMock()));
        testRequest
                .getTaskRefToMockOutput()
                .put("simple_task_1__1", List.of(new WorkflowTestRequest.TaskMock()));
        testRequest
                .getTaskRefToMockOutput()
                .put("simple_task_5", List.of(new WorkflowTestRequest.TaskMock()));

        Workflow execution = workflowClient.testWorkflow(testRequest);
        assertNotNull(execution);

        // Verfiy that the workflow COMPLETES
        assertEquals(Workflow.WorkflowStatus.COMPLETED, execution.getStatus());

        // That the workflow executes a wait task
        assertTrue(
                execution.getTasks().stream()
                        .anyMatch(t -> t.getReferenceTaskName().equals("wait")));

        // That the call_made variable was set to True
        assertEquals(true, execution.getVariables().get("call_made"));

        // Total number of tasks executed are 17
        assertEquals(17, execution.getTasks().size());
    }
Demonstrates how to test workflows that contain sub-workflows
client/src/test/java/com/netflix/conductor/client/testing/SubWorkflowTest.java