/**
  * @dataProvider dataProviderParseError
  */
 public function testParseError($expectError, $apiResponse, $code = null, $message = null)
 {
     $this->setExpectedException($expectError ? '\\RuntimeException' : null);
     $result = $this->parserStub->parse($apiResponse);
     $this->assertInstanceOf('Google\\Api\\Response', $result);
     $this->assertFalse($result->isSuccess());
     $this->assertNull($result->getData());
     $this->assertInstanceOf('Google\\Api\\Response\\Error', $result->getError());
     $this->assertEquals($code, $result->getError()->getCode());
     $this->assertEquals($message, $result->getError()->getMessage());
 }
 /**
  * Executes the API request and returns a parsed and formatted Response object.
  *
  * @return Response
  */
 public function executeRequest()
 {
     $this->validateParameters();
     $parser = new Parser($this->getDataParser());
     return $parser->parse($this->executeApiRequest());
 }