You need to sign in to do that
Don't have an account?
Test Coverage for a Class of Constants
I have a class that is this:
public with sharing class Constants { public static final String NOZZLE = 'Nozzle'; public static final String MANIFOLD = 'Manifold'; public static final String INLET = 'Inlet';
I am attempting to write test code for it, test class looks like this:
@isTest private class Test_Constants { static testMethod void myUnitTest() { Constants con = new Constants(); System.assertEquals(Constants.ACTUATOR_COST,Constants.ACTUATOR_COST);
For some reason I'm getting 0 test coverage. For the Systerm.assert, I tried con. rather than constants. but got an error... Added in a System.Debug in the test as well and the string value for the variable is getting pulled, not sure why Salesforce is reporting 0 coverage.
Thanks everyone... Yeah after reading these and more experimenting, it seems as those variable declarations can't really be tested, but at the same time aren't counted in test coverage, so it's 0 of 0.
All Answers
public void Constants(){}
You may need at least 1 line of running code though to get coverage.
Thanks everyone... Yeah after reading these and more experimenting, it seems as those variable declarations can't really be tested, but at the same time aren't counted in test coverage, so it's 0 of 0.