private void runDetourFlowAndExpect( String flowName, Object expressionValue, boolean nullReturnsTrue, Object payload, String expected) throws Exception { MuleEvent initialEvent = getTestEvent(payload); initialEvent.setFlowVariable(FLOW_VAR_WHEN, expressionValue); initialEvent.setFlowVariable(FLOW_VAR_NULL_RETURNS_TRUE, nullReturnsTrue); initialEvent.getMessage().setOutboundProperty("foo", "bar"); MuleEvent resultEvent = runFlow(flowName, initialEvent); assertThat(resultEvent.getMessage().getPayloadAsString(), is(expected)); }