public function testExecuteWithException()
 {
     $this->requestMock->expects($this->at(0))->method('getParam')->with('item_id', null)->willReturn('1');
     $this->requestMock->expects($this->at(1))->method('getParam')->with('item_qty', null)->willReturn('2');
     $exception = new \Exception('Error!');
     $this->sidebarMock->expects($this->once())->method('checkQuoteItem')->with(1)->willThrowException($exception);
     $this->loggerMock->expects($this->once())->method('critical')->with($exception)->willReturn(null);
     $this->sidebarMock->expects($this->once())->method('getResponseData')->with('Error!')->willReturn(['success' => false, 'error_message' => 'Error!']);
     $this->jsonHelperMock->expects($this->once())->method('jsonEncode')->with(['success' => false, 'error_message' => 'Error!'])->willReturn('json encoded');
     $this->responseMock->expects($this->once())->method('representJson')->with('json encoded')->willReturn('json represented');
     $this->assertEquals('json represented', $this->updateItemQty->executeInternal());
 }
 /**
  * {@inheritdoc}
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch');
     if (!$pluginInfo) {
         return parent::dispatch($request);
     } else {
         return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo);
     }
 }