• Supriya Bethala 1
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
I have tried to write test class below apex class, its below in that code i can acheive 100% apex test coverage, but in  test class
// i need to bring the case created name here to match the actual values. but getting null values.
- System.assertEquals(applicantId, testFilteredObjects[0].actor); this line i am getting expected values as null- thats why my test class failed, please help me sort out of this,

Please let me  know if you need further information.

Apex class - TimelineCase
 public class TimelineCase extends TimelineObject implements HisTimelineObject{
    public List<TimelineObject> processTimelineItem(id recordId, Integer pageNo, Integer pageSize){
        List<TimelineObject> wrappedCase = new List<TimelineObject>();
        
        List<Case> t = [SELECT Id, Subject, AccountId, CreatedDate, CreatedBy.Name
                        FROM   Case
                        WHERE  Applicant__c = :recordId 
                        LIMIT :pageSize
                        OFFSET :pageNo];
        
        
        if(t != null){
            for(Integer i = 0, CaseSize = t.size(); i < CaseSize; i++){ 
                wrappedCase.add(new TimelineObject().setActor(t[i].CreatedBy.Name)
                                                           .setHeader(t[i].Subject)
                                                           .setDate(t[i].CreatedDate.format())
                                                           .setIconName('standard:case')
                                                           .setIconColour('put the colour in here'));
                
            }
        }

        return wrappedCase;
    }
    
}

Test class

@isTest
public class TimelineCaseTest {
    @isTest 
    public static void itShouldBeAbleToGetApplicantCaseListTest1(){
        String applicantId = new TimelineControllerBuilder().save();
        
      Case caseApplicant = new CaseBuilder().withApplicant(applicantId)
                                                .save();
        TimelineCase historyTimelineCase = new TimelineCase();

               
        Test.startTest();
        List<TimelineObject> testFilteredObjects = historyTimelineCase.processTimelineItem(applicantId, 1, 10);
        
        Test.stopTest();
        System.debug('Case result' + caseApplicant.CreatedBy.Name + testFilteredObjects[0].actor);
        System.assertEquals(1, testFilteredObjects.size());
        //Expected values showing null, actual values get correct
        System.assertEquals(applicantId, testFilteredObjects[0].actor);
               
        System.assertEquals(, testFilteredObjects[0].itemDate);
        System.assertEquals('standard:case', testFilteredObjects[0].iconName);
        System.assertEquals('put the colour in here', testFilteredObjects[0].iconColour);
            
    }

}
Hi Guys,

I'm trying to build a lightning component which will be used on Opportunity lightning UI. The component is placed in the right panel. The component loads pretty well on any Opportunity record view.

The problem here is when I try to update the opportunity record (which comes as popup block) the component in the right panel is not getting refreshed. By this the updated values are not showing up on the lightint component.

Need to find a way to refresh the lightning component on record save.

Any help would be appreciated!! 

Thanks
Shravan