"Mock" comes from Old French mocquer, "to deride"; by the 18th century it meant an imitation, and by the 1990s a test object that imitates a collaborator.
The word entered English in the 15th century from Old French mocquer, "to laugh at, to deride". The sense of "imitation, counterfeit" appears by the 18th century ("a mock trial", "mock turtle soup"). In the 1990s, the object-oriented testing community borrowed it for objects that imitate a collaborator and check that the imitation was used correctly.