/**
* @expectedException Google\Spreadsheet\Exception\ResourceNotFoundException
*/
public function testGetResourceByIdException()
{
$resourceId = "http://resource";
$mockRequest = $this->getMockBuilder(DefaultServiceRequest::class)->setMethods(["get"])->disableOriginalConstructor()->getMock();
$mockRequest->expects($this->once())->method("get")->with($this->equalTo($resourceId))->will($this->throwException(new BadRequestException()));
ServiceRequestFactory::setInstance($mockRequest);
$spreadsheetService = new SpreadsheetService();
$spreadsheet = $spreadsheetService->getResourceById(Spreadsheet::class, $resourceId);
}