Refactoring to avoid code duplication and add unit tests.
Add mocker\adapter and mocker\adapter\invoker.