How to prevent the use of ObjectManagaer in the Unit test Magento 2?

Magento 2 with the Unit test for a module, Avoid direct use of Helper\ObjectManager in a Unit test.

Many developers used the native Magento\Framework\TestFramework\Unit\Helper\ObjectManager class for creating mock and objects.

In the initial launch of Magento 2, They used ObjectManager class to write Unit test due to constructor dependencies are not stable.

Now Magento has a constructor dependency stable and Core Magento reduces the use of Helper ObjectManager directly in Unit test.

Old Pattern,

In the above test case, we have used ObjectManager to define the constructor method of the parent class.

New Way without the use of ObjectManager in a Unit test,

We directly call our Class with the new keyword and create an Object for Main class.