I have the following query inside an @HttpGet REST API method:
SELECT Document_Id__c FROM Content_Link__c
GROUP BY Document_Id__c HAVING Count(Account__c) > 0
When run regularly I see the following in Debug Log:
13:06:43.0 (5132373)|SOQL_EXECUTE_BEGIN|[45]|Aggregations:0|SELECT Document_Id__c FROM Content_Link__c
13:06:43.0 (31522308)|SOQL_EXECUTE_END|[45]|Rows:800
When run from a test method (same org) I see the following in Debug Log:
13:21:49.0 (10552643)|SOQL_EXECUTE_BEGIN|[45]|Aggregations:0|SELECT Document_Id__c FROM Content_Link__c
13:21:49.0 (12525977)|SOQL_EXECUTE_END|[45]|Rows:0
This absence of any result rows is causing some lines to not execute during the test, reducing my code coverage. Any ideas what's causing this?