I am facing a bizarre situation where test class coverage is 100% irrespective of how much logic is implemented in the test class. Below is the class
public with sharing class testconstants{ public static string str1 ='firststring'; public string str2='secondstring'; public string str3='thirdstring'; } The test class is
@isTest public class testcontants_testclass{ static testmethod void method1() { testconstants t = new testconstants(); test.starttest(); system.assertEquals(testconstants.str1,'firststring'); test.stoptest(); } } Now even if I am keeping two asserts (one for str1 and other for str2) or only one assert (as above) , the coverage is reaching 100%.
staticconstants as the test is then really only confirming that the compiler/runtime works and any change to the constants will require tedious change to the test.