On a VF Page, I am displaying Case's history related list with a custom tabular format. I am querying Case history object in an Apex class (under Constructor):
caseHist = [Select OldValue, NewValue, Field, CreatedDate, CreatedBy.Name,
CreatedBy.FirstName, CreatedBy.LastName
From CaseHistory Where CaseId =:currentCase.Id ORDER BY CreatedDate DESC];
Just using a return method to get the data:
public List<CaseHistory> getCaseHistory(){
return caseHist;
}
On VF page:
<apex:repeat value="{!caseHistory}" var="casHistory">
<div class="question-container">
<div class="section1">
{!casHistory.CreatedBy.LastName}, {!casHistory.CreatedBy.FirstName}
</div>
<div class="section2" >
Changed {!casHistory.Field} from {!casHistory.OldValue} to {!casHistory.NewValue}
</div>
<div class="section3">
{!casHistory.CreatedDate}
</div>
</div>
</apex:repeat>
My understanding is: In a test class, we are not actually committing any records to the database to update few fields and get the tracking history for those. Now I am wondering, how could I get 100% of my Apex class's code coverage? Right now, I got 73% covered.