public function testRetryCount()
 {
     $this->policy->registerException($this->context, new \RuntimeException('foo'));
     $this->assertEquals(1, $this->context->getRetryCount());
     $this->assertEquals('foo', $this->context->getLastException()->getMessage());
 }
 public function canRetry(RetryContextInterface $context)
 {
     $e = $context->getLastException();
     return (!$e || $this->shouldRetryForException($e)) && $context->getRetryCount() < $this->maxAttempts;
 }