GPII-657: Calling mockjaxClear() at the end of every mocked test.
GPII-657: Refactored the code to use a single, test-generating function.