/** * Run test execute method (fail load shipment model) */ public function testExecuteLoadShipmentFail() { $this->shipmentLoaderMock->expects($this->once())->method('load')->willThrowException(new \Magento\Framework\Exception\LocalizedException(__('message'))); $this->messageManagerMock->expects($this->once())->method('addError')->will($this->returnSelf()); $this->redirectSection(); $this->assertNull($this->controller->execute()); }