/** * @expectedException \Magento\Framework\Exception\NoSuchEntityException * @expectedExceptionMessage Invalid customer id 100 */ public function testValidateInvalidCustomer() { $customerId = 100; $this->customerFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->customerMock)); $this->customerMock->expects($this->once())->method('load')->with($customerId); $this->customerMock->expects($this->once())->method('getId')->will($this->returnValue(null)); $addressData = $this->addressDataBuilder->setCustomerId($customerId)->setCompany('eBay Inc')->create(); $this->model->validate($addressData); }