In PhpUnit 5 we was able to set expected class name and then to check it's error message
$this->setExpectedException('Cake\Network\Exception\NotFoundException');
$this->assertEquals('Not Found', $this->_exception->getMessage());
How to do the same in PhpUnit 6?