You need to sign in to do that
Don't have an account?
Sid Childers
Error Initial Term of Field Expression must be a concrete SObject.List<StaticResource>
I've written the following in a test class attempting to achieve adequate code coverage by parsing XML nodes into various field values. I want to reference the static resource XML file in test classes instead of entering the actual XML and assigning it to a XMLStr. However, I am receiving the error stated above.
What must be fixed in order for the Static Resource to be loaded into the test class, XML nodes evaluated etc.?
List<StaticResource> ifx; ifx = [Select Body from StaticResource where Name = '{Direct8_8_Decision}' LIMIT 1]; string XMLStr = ifx.body.ToString(); Dom.Document xmlDoc = new Dom.Document(); xmlDoc.load(xmlStr); IFXLoadXML.IFXMain ifxObj = new IFXLoadXML.IFXMain(xmlDoc.getRootElement()); System.assertNotEquals(null, xmlDoc);
What must be fixed in order for the Static Resource to be loaded into the test class, XML nodes evaluated etc.?
Your query is not returning any record.
All Answers
string XMLStr = ifx[0].body.ToString();
You have list on sobject not the sObject alone.
Your query is not returning any record.