function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mhlangano Khumalo 7Mhlangano Khumalo 7 

How to cover logic for enforcing FLS in test class for lightning controller.

How to test code for enforcing FLS.
I have a test class that only has 75% coverage. I need to test for when the user does not have Read access to Client_Strategy__c  custom field in FLS and I also need to Cover 'Catch'.
User-added image
Test Class:
public class CI_ClientOverviewControllerTest {
    static void setupTestData() {   
        List<Account> client = new List<Account>();        
        client.add(new Account(Name= 'Google Inc',Client_Strategy__c = 'Strategy for the client'));
        insert client;  
    public static testMethod void PositiveTest(){
        List<Account> client = [select id from Account where name ='Google Inc'];    
Any Ideas?