private function getInMemoryAdapter(array $messages)
 {
     $adapter = new InMemoryAdapter();
     foreach ($messages as $message) {
         $adapter->publish(json_encode($this->serializer->serialize($message)));
     }
     return $adapter;
 }
 private function getInMemoryAdapterWithOnePublishedMessage()
 {
     $adapter = new InMemoryAdapter();
     $adapter->publish(json_encode($this->serializer->serialize($this->createDomainMessage(array('foo' => 'bar')))));
     return $adapter;
 }