System.QueryException: Didn't understand relationship 'account' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
When I run the test classes, test classes are failing with the above errors! Any threads/Pointers will be appreciated.
Please find the code below:
Class
*Public Class ClassName{
Public ClassName(){
// getting current login user record
User userrecord = [select id,Name,accountId,account.parentId,profile.Name
from User where id =: UserInfo.getUserId()]; // exception occurring at this line
}
//and other logic
}*
Test Class
*@isTest(seealldata = false)
public class ClassName_UT{
static testmethod void testMethodOne(){
// User creation --> CommunityUserObj (we have some utility classes for creating objects)
test.startTest();
system.runas(CommunityUserObj){
ClassName objName= new ClassName(); // exception occurring at this line
test.stopTest();
}
}
}*
Thanks
Comments
Post a Comment