Meet API consistency standards : check for nulls and virtual methods

Add TODOs query model visitor and fix minor bug in mock test framework.