You need to sign in to do that
Don't have an account?

I need to unit test a Document with Document ID
I have a list and list should Contain a certain document that has an ID
List<String> blst = new List<String>();
System.debug('inside the empty folder to set up the proposal');
c = [SELECT Id, Name, Body
from Document
Where Id =: FoId];
System.debug('Adding one file to the PDF ');
blst.add(EncodingUtil.base64Encode(c.Body));
my unit test its keep telling me the id is empty even tho I make sure FoID is assign
Unit test FoId= '123456';
how can I test that
List<String> blst = new List<String>();
System.debug('inside the empty folder to set up the proposal');
c = [SELECT Id, Name, Body
from Document
Where Id =: FoId];
System.debug('Adding one file to the PDF ');
blst.add(EncodingUtil.base64Encode(c.Body));
my unit test its keep telling me the id is empty even tho I make sure FoID is assign
Unit test FoId= '123456';
how can I test that
All Answers
c = [SELECT Id, Name, Body from Document Where Id =: FoId]; //Here it is wrong as per my understanding salesforce have 15 digit or 18 digit Id
You cannot assign any random integer value and query that.
This FoId should be a valid salesforce Id, Either 15 digit or 18 digit, both works fine.
Set this at the top of your test class.
System.QueryException: List has no rows for assignment to SObject