public function testGetList()
 {
     $criteriaMock = $this->getMockBuilder('Magento\\CatalogInventory\\Api\\StockStatusCriteriaInterface')->getMock();
     $queryBuilderMock = $this->getMockBuilder('Magento\\Framework\\DB\\QueryBuilder')->disableOriginalConstructor()->setMethods(['setCriteria', 'setResource', 'create'])->getMock();
     $queryMock = $this->getMockBuilder('Magento\\Framework\\DB\\QueryInterface')->getMock();
     $queryCollectionMock = $this->getMockBuilder('Magento\\CatalogInventory\\Api\\Data\\StockStatusCollectionInterface')->getMock();
     $this->queryBuilderFactoryMock->expects($this->once())->method('create')->willReturn($queryBuilderMock);
     $queryBuilderMock->expects($this->once())->method('setCriteria')->with($criteriaMock)->willReturnSelf();
     $queryBuilderMock->expects($this->once())->method('setResource')->with($this->stockStatusResourceMock)->willReturnSelf();
     $queryBuilderMock->expects($this->once())->method('create')->willReturn($queryMock);
     $this->stockStatusCollectionMock->expects($this->once())->method('create')->willReturn($queryCollectionMock);
     $this->assertEquals($queryCollectionMock, $this->model->getList($criteriaMock));
 }
 /**
  * @param \Magento\CatalogInventory\Api\StockStatusCriteriaInterface $criteria
  * @return \Magento\CatalogInventory\Api\Data\StockStatusCollectionInterface
  */
 public function getList(\Magento\CatalogInventory\Api\StockStatusCriteriaInterface $criteria)
 {
     $queryBuilder = $this->queryBuilderFactory->create();
     $queryBuilder->setCriteria($criteria);
     $queryBuilder->setResource($this->resource);
     $query = $queryBuilder->create();
     $collection = $this->stockStatusCollectionFactory->create(['query' => $query]);
     return $collection;
 }