I have an extension for Case object but it does not go to my extension method. Is there anything I forgot to include in my code
This is a snippet of test class
> test.startTest();
ApexPages.StandardController sc = new ApexPages.StandardController(Case_test[0]);
CaseExtension CaseExt = new CaseExtension(sc);
test.stopTest();
This is the extension
public class CaseExtension {
ApexPages.StandardController c;
public CaseExtension(ApexPages.StandardController controller) {
c = controller;
}
public PageReference updateCase() {
Case caseRecord = (Case)c.getRecord();
List<Case> caseForUpdate = new list<Case>();
for(Case c: [SELECT Id,Changed_into_In_progress__c ,viewed_by_Handler_TimeStamp__c,viewed_by_Handler__c, OwnerId, Case_Brand_Handler__c, Transaction_Group__c, Transaction_Item__c, Status
FROM Case WHERE Id =: caseRecord.Id ]){
//system.assertequals(c,null);
if(c.viewed_by_Handler_TimeStamp__c == NULL && UserInfo.getUserId() == c.OwnerId){
if(c.Transaction_Group__c == 'Sample' && c.Transaction_Item__c == 'Sample' && c.Changed_into_In_progress__c == NULL){
c.viewed_by_Handler__c = TRUE;
c.viewed_by_Handler_TimeStamp__c = System.now();
caseForUpdate.add(c);
}
}
}
if( caseForUpdate.size() > 0 ){
update caseForUpdate;
}
return null;
}
}
if( caseForUpdate.size() > 0 ){
is superfluous and can be removed