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
Alex.AcostaAlex.Acosta 

Getting Code Coverage on 'final' classified variables?

I have a constant variable class for parsing out xml stucture on callouts as seen below. Problem is the way code is covered has changed it seems. Any idea why and/or how to fix this?

 
public with sharing class XMLElementNodeNames {
  public static final String CATEGORY_TAG = 'category';
  public static final String CATEGORIES_TAG = 'categories';
  public static final String ID_TAG = 'id';
  public static final String SCORE_TAG = 'score';
  ...
  static testmethod void testAll() {
// only having the following line would cover the class. Now it returns with 0% coverage
XMLElementNodeNames x = new XMLElementNodeNames();

// I have since added the following to try for code coverage to no avail.
String theString;
theString = CATEGORY_TAG;
theString = CATEGORIES_TAG;
theString = ID_TAG;
theString = SCORE_TAG;
....
  }
}
Ashish_SFDCAshish_SFDC
Hi Alex, 


During code Code coverage - we have to write a test class that has dummy records inserted (based on how the class will be called) - which in turn should call this class and methods. 


Regards,
Ashish