/**
  * @test
  */
 public function invoke_should_invoke_reflection()
 {
     $payload = new Message();
     $consumer = new Consumer();
     $reflectionMethod = $this->prophesize(ReflectionMethod::class);
     $reflectionMethod->invoke($consumer, $payload)->shouldBeCalled();
     $container = new ConsumerContainer(self::TEST_PREFIX, $consumer, $reflectionMethod->reveal(), new ConsumerAnnotation());
     $container->invoke($payload);
 }
 /**
  * @param ConsumerContainer $consumerContainer
  * @param AMQPMessage $message
  *
  * @throws ConsumerContainerException
  * @return mixed|null
  */
 private function invoke(ConsumerContainer $consumerContainer, AMQPMessage $message)
 {
     $payload = $this->serializer->deserialize($message->body, $consumerContainer->getMessageClass(), 'json');
     try {
         $result = $consumerContainer->invoke($payload);
     } catch (Exception $e) {
         $containerException = new ConsumerContainerException($consumerContainer, $message, $payload, $e);
         if ($this->errorHandlers->isEmpty()) {
             throw $containerException;
         }
         $this->errorHandlers->map(function (ErrorHandlerInterface $handler) use($containerException) {
             $handler->handle($containerException);
         });
         return null;
     }
     return $result;
 }