refactor IntegTestQuery