Category: Unit Testing

A Simple Approach to Mock HttpClient Calls

The current recommended approach to do HTTP calls using C# is to use HttpClient. This class is disposable, meaning that it should be used inside a using statement. For example, like in this class: [crayon-67d7641ae6b7c649637026/] This ensures that the HttpClient instance is properly disposed by the garbage collector once...

How To: Mock a Static Method in Java

As you know, at the time of writing, mainstream Java mock libraries such as Mockito or EasyMock cannot mock static methods, final classes, constructors, etc. These limitations sometime force us to put aside good design for test implementation. This is where PowerMock comes into play. It offers some useful...