/** * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDataFixture Magento/Customer/_files/customer_address.php */ public function testDeleteAddress() { $addressId = 1; // See that customer already has an address with expected addressId $addressDataObject = $this->repository->getById($addressId); $this->assertEquals($addressDataObject->getId(), $addressId); // Delete the address from the customer $this->repository->delete($addressDataObject); // See that address is deleted try { $addressDataObject = $this->repository->getById($addressId); $this->fail("Expected NoSuchEntityException not caught"); } catch (NoSuchEntityException $exception) { $this->assertEquals('No such entity with addressId = 1', $exception->getMessage()); } }