// Create mock muleContext
MuleContext muleContext = Mockito.mock(MuleContext.class);
MuleRegistry registry = Mockito.mock(MuleRegistry.class);
Mockito.when(muleContext.getRegistry()).thenReturn(registry);
Mockito.when(muleContext.getExecutionClassLoader()).thenReturn(getClass().getClassLoader());
Mockito.when(registry.lookupFlowConstruct("flow")).thenReturn(flow);
// Serialize and then deserialize
DefaultMuleSession after = (DefaultMuleSession) SerializationUtils.deserialize(
SerializationUtils.serialize(before), muleContext);