When I use the code snipped provided for the Count api call my IDE reports two issues.
The first is that querySource is not public and can't be accessed outside the package
The second is that the provided code snippet is missing a closing paren.
Here's the code from the API doc page:
CountResponse response = client.count(countRequest("test")