public function testGetters()
 {
     $httpStatusCode = 123;
     $headers = array(0 => 'Foo', 'Bar' => 'Baz');
     $body = "Foo Bar\nBáz";
     $connectionReponse = new DefaultConnectionResponse($httpStatusCode, $headers, $body);
     $this->assertEquals($httpStatusCode, $connectionReponse->getHttpStatusCode());
     $this->assertEquals($headers, $connectionReponse->getHeaders());
     $this->assertEquals($body, $connectionReponse->getBody());
     $this->assertEquals('Foo', $connectionReponse->getHeaderValue(0));
     $this->assertEquals('Baz', $connectionReponse->getHeaderValue('Bar'));
     $this->assertEquals('Baz', $connectionReponse->getHeaderValue('bar'));
     $this->assertEquals('', $connectionReponse->getHeaderValue(1));
     $this->assertEquals('', $connectionReponse->getHeaderValue('baz'));
 }
    public function testReferenceException()
    {
        $callContext = new CallContext();
        $callContext->setIdempotenceKey('test');
        $responseHeaders = array('Content-Type' => 'application/json', 'X-GCS-Idempotence-Request-Timestamp' => '12345');
        $responseBody = <<<EOD
{
   "errorId" : "75b0f13a-04a5-41b3-83b8-b295ddb23439-000013c6",
   "errors" : [ {
      "code" : "1400",
      "message" : "DUPLICATE REQUEST IN PROGRESS",
      "httpStatusCode" : 409
   } ]
}
EOD;
        $connectionResponse = new DefaultConnectionResponse(409, $responseHeaders, $responseBody);
        $responseFactory = new ResponseFactory();
        $responseExceptionFactory = new ResponseExceptionFactory();
        $exception = $responseExceptionFactory->createException($connectionResponse->getHttpStatusCode(), $responseFactory->createResponse($connectionResponse, new ResponseClassMap(), $callContext), $callContext);
        $this->assertInstanceOf('\\Ingenico\\Connect\\Sdk\\ReferenceException', $exception);
    }