Add tests for Query class