/**
  * Run test getCommentsList method
  */
 public function testGetCommentsList()
 {
     $id = 25;
     $returnValue = 'return-value';
     $filterMock = $this->getMock('Magento\\Framework\\Api\\Filter', [], [], '', false);
     $searchCriteriaMock = $this->getMock('Magento\\Framework\\Api\\SearchCriteria', [], [], '', false);
     $this->filterBuilderMock->expects($this->once())->method('setField')->with('parent_id')->will($this->returnSelf());
     $this->filterBuilderMock->expects($this->once())->method('setValue')->with($id)->will($this->returnSelf());
     $this->filterBuilderMock->expects($this->once())->method('create')->will($this->returnValue($filterMock));
     $this->searchCriteriaBuilderMock->expects($this->once())->method('addFilter')->with(['eq' => $filterMock]);
     $this->searchCriteriaBuilderMock->expects($this->once())->method('create')->will($this->returnValue($searchCriteriaMock));
     $this->creditmemoCommentRepositoryMock->expects($this->once())->method('getList')->with($searchCriteriaMock)->will($this->returnValue($returnValue));
     $this->assertEquals($returnValue, $this->creditmemoService->getCommentsList($id));
 }
 /**
  * Returns list of comments attached to creditmemo
  *
  * @param int $id
  * @return \Magento\Sales\Api\Data\CreditmemoCommentSearchResultInterface
  */
 public function getCommentsList($id)
 {
     $this->searchCriteriaBuilder->addFilters([$this->filterBuilder->setField('parent_id')->setValue($id)->setConditionType('eq')->create()]);
     $searchCriteria = $this->searchCriteriaBuilder->create();
     return $this->commentRepository->getList($searchCriteria);
 }
 /**
  * Returns list of comments attached to creditmemo
  * @param int $id
  * @return \Magento\Sales\Api\Data\CreditmemoCommentSearchResultInterface
  */
 public function getCommentsList($id)
 {
     $this->searchCriteriaBuilder->addFilter(['eq' => $this->filterBuilder->setField('parent_id')->setValue($id)->create()]);
     $criteria = $this->searchCriteriaBuilder->create();
     return $this->creditmemoCommentRepository->getList($criteria);
 }