refactored to generalize mock tests functionality into a common tests fu...

...nctionality