You need to sign in to do that
Don't have an account?
Superbadge Advanced Apex Specialist in step 8 i am facing an error
Challenge Not yet complete... here's what's wrong:
Ensure that after you clear test data, you run your tests once and the required test coverage is achieved.
here is my code for AnnouncementQueueable covage 58 % for this:-
AnnouncementQueueable:
/**
* @name AnnouncementQueueable
* @description This class posts Chatter Announcements
**/
public class AnnouncementQueueable implements Queueable{
public List<ConnectApi.AnnouncementInput> toPost;
//ToDo: Modify this class to implement the Queueable interface and call the postAnnouncements method
public void execute(QueueableContext context) {
PostAnnouncements(toPost);
}
/**
* @name postAnnouncements
* @description This method is provided for you to facilitate the Super Badge
**/
public static void PostAnnouncements(List<ConnectApi.AnnouncementInput> announcements){
while ( announcements.size() > 0 ){
if ( Limits.getDMLStatements() < Limits.getLimitDMLStatements() && !test.isRunningTest() ){
ConnectApi.AnnouncementInput a = announcements.remove(0);
ConnectApi.Announcements.postAnnouncement('Internal', a);
} else {
break;
}
}
if ( announcements.size() > 0 && !test.isRunningTest() ){
AnnouncementQueueable q = new AnnouncementQueueable();
q.toPost = announcements;
//ToDo: Enqueue the above instance of announcementQueueable
System.enqueueJob(q);
}
}
}
Ensure that after you clear test data, you run your tests once and the required test coverage is achieved.
here is my code for AnnouncementQueueable covage 58 % for this:-
AnnouncementQueueable:
/**
* @name AnnouncementQueueable
* @description This class posts Chatter Announcements
**/
public class AnnouncementQueueable implements Queueable{
public List<ConnectApi.AnnouncementInput> toPost;
//ToDo: Modify this class to implement the Queueable interface and call the postAnnouncements method
public void execute(QueueableContext context) {
PostAnnouncements(toPost);
}
/**
* @name postAnnouncements
* @description This method is provided for you to facilitate the Super Badge
**/
public static void PostAnnouncements(List<ConnectApi.AnnouncementInput> announcements){
while ( announcements.size() > 0 ){
if ( Limits.getDMLStatements() < Limits.getLimitDMLStatements() && !test.isRunningTest() ){
ConnectApi.AnnouncementInput a = announcements.remove(0);
ConnectApi.Announcements.postAnnouncement('Internal', a);
} else {
break;
}
}
if ( announcements.size() > 0 && !test.isRunningTest() ){
AnnouncementQueueable q = new AnnouncementQueueable();
q.toPost = announcements;
//ToDo: Enqueue the above instance of announcementQueueable
System.enqueueJob(q);
}
}
}
We have separate Trailhead team who can help you with these issues. So,can you please use the below link to reach out to them so that one of the agent will get in touch with you.
Support:https://trailhead.salesforce.com/help
Thank you!
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks,
Vinay Kumar