METAREST-2 Moves QueryBuilder mocking logic into factory class