You need to sign in to do that
Don't have an account?

Can you please help me this apex class and testclass with using system assert equals
class
public B_AsyncContactImport_Mailchimp(String mailChimpListId, Integer members_count, Integer members_offset, Boolean insertDuplicates, Integer saved_members_count, String tagName) {
this.mailChimpListId = mailChimpListId;
this.members_count = members_count;
this.members_offset = members_offset;
this.insertDuplicates = insertDuplicates;
this.saved_members_count = saved_members_count; //initially it's zero.
this.tagName = tagName;
}
test class
@isTest
static void test_AsyncContactImport_Mailchimp(){
Test.startTest();
String listMembersResponse = '{"members":[{"id":"a89d6fa724ea206edb06cd262ce6bf1d","email_address":"user+11@test.com","unique_email_id":"8984312e5e","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"FirstOne","LNAME":"LastOne"},"list_id":"5abcf1f4c5"}],"list_id":"5abcf1f4c5","total_items":1}';
Test.setMock(HttpCalloutMock.class, new B_HttpCalloutMock(200, 'OK', listMembersResponse, null));
try {
B_AsyncContactImport_Mailchimp obj = new B_AsyncContactImport_Mailchimp('5abcf1f4c5',2,3,true,3,'tagName');
//obj.execute(null);
System.enqueueJob(obj);
(new B_AsyncContactImport_Mailchimp('1005',2,3,false,3,null)).execute(null);
} catch(Exception e) {
//System.debug('!=== Exception: ' + e.getStackTraceString());
System.assert(e.getMessage() != null);
}
Test.stopTest() ;
}
public B_AsyncContactImport_Mailchimp(String mailChimpListId, Integer members_count, Integer members_offset, Boolean insertDuplicates, Integer saved_members_count, String tagName) {
this.mailChimpListId = mailChimpListId;
this.members_count = members_count;
this.members_offset = members_offset;
this.insertDuplicates = insertDuplicates;
this.saved_members_count = saved_members_count; //initially it's zero.
this.tagName = tagName;
}
test class
@isTest
static void test_AsyncContactImport_Mailchimp(){
Test.startTest();
String listMembersResponse = '{"members":[{"id":"a89d6fa724ea206edb06cd262ce6bf1d","email_address":"user+11@test.com","unique_email_id":"8984312e5e","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"FirstOne","LNAME":"LastOne"},"list_id":"5abcf1f4c5"}],"list_id":"5abcf1f4c5","total_items":1}';
Test.setMock(HttpCalloutMock.class, new B_HttpCalloutMock(200, 'OK', listMembersResponse, null));
try {
B_AsyncContactImport_Mailchimp obj = new B_AsyncContactImport_Mailchimp('5abcf1f4c5',2,3,true,3,'tagName');
//obj.execute(null);
System.enqueueJob(obj);
(new B_AsyncContactImport_Mailchimp('1005',2,3,false,3,null)).execute(null);
} catch(Exception e) {
//System.debug('!=== Exception: ' + e.getStackTraceString());
System.assert(e.getMessage() != null);
}
Test.stopTest() ;
}
What you want here??
try this