Implemented trait mocking.
Merge pull request #774 from whatthejeff/trait_mocking_master