You need to sign in to do that
Don't have an account?
Akshay Mhetre
test class coverage.....plz help
@AuraEnabled
public static void updateFilesMainCase(String contentVersionIds,String recordId)
{
System.debug('============contentVersionIds===='+contentVersionIds);
if(contentVersionIds != null){
String[] contentVersionIdArr = contentVersionIds.split(',');
Set<String> contentDocumentIds = new Set<String>();
for(String docId : contentVersionIdArr)
{
if(docId != null && docId.length() > 0)
contentDocumentIds.add(docId);
}
System.debug('============contentDocumentIds===='+contentDocumentIds);
// List<Case> listCase = [select Type,Subject from Case where Id=:recordId];
String imgTitle;
List<User> agencyName= [Select Id ,Contact.Account.Name,Profile.Name from User where Id =:UserInfo.getUserId() AND Profile.Name='RCU Agent Community'];
if(agencyName.size()> 0){
imgTitle = agencyName[0].Contact.Account.Name+'-'+String.valueOf(System.now());
}
System.debug('============imgTitle===='+imgTitle);
List<ContentVersion> versionList = [SELECT FileExtension, Title FROM ContentVersion
WHERE ContentDocumentId IN :contentDocumentIds and IsLatest=true ] ;
List<ContentVersion> contentVersionsToUpdate = new List<ContentVersion>();
for(ContentVersion contVersion : versionList)
{
if(imgTitle != null){
contVersion.Title = imgTitle;
}
}
update versionList;
System.debug('recordId: '+recordId);
List<Case> caselist= [Select Id, isAgentReportUploaded__c From Case Where ParentId=:RecordId];
for(Case subC: caseList){
subC.isAgentReportUploaded__c = true;
}
if(!caselist.isEmpty()){
update caselist;
}
//return imgTitle;
}
// return 'error';
}
}
public static void updateFilesMainCase(String contentVersionIds,String recordId)
{
System.debug('============contentVersionIds===='+contentVersionIds);
if(contentVersionIds != null){
String[] contentVersionIdArr = contentVersionIds.split(',');
Set<String> contentDocumentIds = new Set<String>();
for(String docId : contentVersionIdArr)
{
if(docId != null && docId.length() > 0)
contentDocumentIds.add(docId);
}
System.debug('============contentDocumentIds===='+contentDocumentIds);
// List<Case> listCase = [select Type,Subject from Case where Id=:recordId];
String imgTitle;
List<User> agencyName= [Select Id ,Contact.Account.Name,Profile.Name from User where Id =:UserInfo.getUserId() AND Profile.Name='RCU Agent Community'];
if(agencyName.size()> 0){
imgTitle = agencyName[0].Contact.Account.Name+'-'+String.valueOf(System.now());
}
System.debug('============imgTitle===='+imgTitle);
List<ContentVersion> versionList = [SELECT FileExtension, Title FROM ContentVersion
WHERE ContentDocumentId IN :contentDocumentIds and IsLatest=true ] ;
List<ContentVersion> contentVersionsToUpdate = new List<ContentVersion>();
for(ContentVersion contVersion : versionList)
{
if(imgTitle != null){
contVersion.Title = imgTitle;
}
}
update versionList;
System.debug('recordId: '+recordId);
List<Case> caselist= [Select Id, isAgentReportUploaded__c From Case Where ParentId=:RecordId];
for(Case subC: caseList){
subC.isAgentReportUploaded__c = true;
}
if(!caselist.isEmpty()){
update caselist;
}
//return imgTitle;
}
// return 'error';
}
}
find your test class with 100% coverage.
don't forget to mark it as best answer if it's help you.
Thank you
All Answers
Hi Akshay,
Have you tried the test class for it ? If yes, please provide it, we can work on that to increase the coverage.
Regards,
Priya Ranjan
find your test class with 100% coverage.
don't forget to mark it as best answer if it's help you.
Thank you