title: Unit testing Amazon SWF child workflows
body: <p>I have a parent workflow (ParentWorkflow) calling a child workflow (ChildWorkflow) and I'm trying to test out the call.</p>
  
  <p>The parent code looks something like this:</p>
  
  <pre><code>public class ParentWorkflow {
      private final ChildWorkflowClientFactory childWorkflowClientFactory =
              new ChildWorkflowClientFactoryImpl();
  
      public void runWorkflow() {
          new TryCatch() {
              @Override
              protected void doTry() throws Throwable {
                  Promise&lt;Void&gt; workflowFinished = childWorkflowClient.childWorkflow(x);
                  ...
              }
          ...
      }
  }
  </code></pre>
  
  <p>I want to mock out the 
  <code>childWorkflowClient.childWorkflow(x)</code>
  call, however when I am hooking up the unit test I don't appear to have the option to inject the client factory, the unit test code looks like this:</p>
  
  <pre><code>@Rule
  public WorkflowTest workflowTest = new WorkflowTest();
  @Mock
  private Activities mockActivities;
  
  private ParentWorkflowClientFactory workflowFactory
          = new ParentWorkflowClientFactoryImpl();
  
  @Before
  public void setUp() throws Exception {
      // set up mocks
      initMocks(this);
  
      workflowTest.addActivitiesImplementation(mockActivities);
      workflowTest.addWorkflowImplementationType(ParentWorkflowImpl.class);
      workflowTest.addWorkflowImplementationType(ChildWorkflowImpl.class);
  </code></pre>
  
  <p>I don't appear to be able to pass anything into the workflow implementation classes, is there another way I can mock the child workflow out?</p>