I wrote a test class for my batchable class. It works great but I want to limit the query of the test class only to the test object I have created.
So I have this inside my test method:
String query = 'SELECT Id, Name, ShipmentQuantity__c, CurrentQuantity__c FROM Stock__c WHERE Id =: ' + testStock.Id;
And then my test.StartTest():
system.test.startTest(); Database.executeBatch(new IndependentBatch(query)); system.test.stopTest();
The error I get is
"System.QueryException: Variable does not exist: a0236000001bOXdAAM".
Obviously it sees the ID but I don't understand what the error means. If I erase the
Where Id =: ' + testStock.Id; the test runs like a charm.