/** * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage Your password confirmation must match your password. * @magentoDbIsolation enabled */ public function testBeforeSavePasswordsDoNotMatch() { $this->_model->setPassword('password2'); $this->_model->setPasswordConfirmation('password1'); $this->_model->save(); }