Mocking is just replacing or wrapping a function by another function at runtime called a mocking function.
Example:
var request = new HttpRequest(); // the real request
var mockRequest = new HttpMock(request); // the request is wrapped
This function overrule the actual implementation of a function during a test.
It permits then to:
Mock function are generally used to simulate a integration test with third party services such as:
Java:
Javascript: