@Test
public void whenUpdatingStateVariablesUpdateWorkflowInstanceWorks() {

  UpdateWorkflowInstanceRequest req = new UpdateWorkflowInstanceRequest();
  req.stateVariables.put("foo", "bar");
  req.stateVariables.put("textNode", new TextNode("text"));
  resource.updateWorkflowInstance(3, req);
  verify(workflowInstances).updateWorkflowInstance(workflowInstanceCaptor.capture(),
      (WorkflowInstanceAction) argThat(hasField("stateText", equalTo("API updated state variables."))));
  WorkflowInstance instance = workflowInstanceCaptor.getValue();
  assertThat(instance.getStateVariable("foo"), is("bar"));
  assertThat(instance.getStateVariable("textNode"), is("\"text\""));
}