Create class Mock and move related functions into it.