public function it_performs_a_HTTP_request_to_the_given_url_and_raises_an_error_if_failed(HttpMethodsClient $client, ResponseInterface $response, HttpException $e)
 {
     $client->sendRequest(Argument::type(RequestInterface::class))->willThrow($e->getWrappedObject());
     $e->getResponse()->willReturn($response);
     $response->getStatusCode()->willReturn(500);
     $response->getBody()->willReturn('{"error":"foo"}');
     $this->shouldThrow(new CommunicationException('500 : foo'))->during('request', ['GET', 'bar']);
 }
 function it_throws_exception_when_request_returns_not_found_error(HttpClientInterface $httpClient, RequestFactoryInterface $requestFactory, RequestInterface $request, ResponseInterface $response, HttpException $httpException)
 {
     $apiHttpPathAndQuery = ApiHttpPathAndQuery::createForPath(self::API_PATH);
     $response->getStatusCode()->willReturn(404);
     $requestFactory->createRequest(Argument::any(), Argument::any(), Argument::any())->willReturn($request);
     $httpException->getResponse()->willReturn($response);
     $httpClient->sendRequest($request)->willThrow($httpException->getWrappedObject());
     $this->shouldThrow(ApiHttpClientNotFoundException::class)->duringGet($apiHttpPathAndQuery);
 }