Add unit tests for QueryErrorDetectionStrategy.

Add null checking in QueryErrorDetectionStrategy.