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
NLTNLT 

code coverage for apex class

Hi All, Please help me on code coverage of below lines of code.

public String preQuestionsCategoryMapKeys {get {
        String keys = '';
        for (String key : preQuestionsCategoryMap.keySet()) {
            keys += key + ',';
        }
        return keys.removeEnd(',');
    }}

public Integer emdrStatusMapSize { get { return emdrStatusMap.size(); } }
Suraj Tripathi 47Suraj Tripathi 47

Please find the test code coverage.

String data=ClassName.preQuestionsCategoryMapKeys;
Integer data2=ClassName.emdrStatusMapSize;

Make your getter as static

public static  String preQuestionsCategoryMapKeys {get {
        String keys = '';
        for (String key : preQuestionsCategoryMap.keySet()) {
            keys += key + ',';
        }
        return keys.removeEnd(',');
    }}
 

public static Integer emdrStatusMapSize { get { return 2; } }

Please mark it as the Best Answer if it helps you.

Thank You