/** * Run test prepare method (Exception) * * @return void * * @expectedException \Magento\Framework\Exception\LocalizedException * @expectedExceptionMessage The configuration parameter "formElement" is a required for "test-name" field. */ public function testPrepareException() { $this->uiComponentFactoryMock->expects($this->never())->method('create'); $this->field->setData(['name' => self::NAME]); $this->field->prepare(); }