How to insulate yourself from static methods
Sometimes your code needs to call a static method in a 3rd party library and unit testing suddenly becomes difficult, particularly when that static method requires context in order to work.
Enter the insulating class (also known as a Facade).
Create a new interface that declares a method with the same signature as the static method you want to delegate to Create a new Facade class that implements the interface Replace the calls to the static method with calls to your new Facade class Let’s assume that the method you need to call looks like this
[Read More]