vendredi 28 février 2020

Test Methods With No Assert result

Can anyone help me in test class......................................

I have an error in test method assert ............................

Error message :

test method assert

test class :

@isTest
public class TwnxTest {
    //this method for testing with names as "Twilio"
    public static testmethod void testSmsFromTwnxWithNameAsTwilio(){        

        Contact con = new Contact(LastName='test',Phone='+19343213321');
        insert con;

        ApexPages.StandardController sc = new ApexPages.StandardController(con);

        Twnx twInstance = new Twnx(sc);

        configuration_setting__c configSettings= new configuration_setting__c();
        configSettings.Name='Twilio';
        configSettings.AccountSid__c = 'accountId';
        configSettings.Active__c = true;
        configSettings.AuthToken__c ='auth002';
        configSettings.Bulk_SMS__c='+18559331384';
        configSettings.Contact_Phone_Number__c='+18559172384';
        configSettings.Lead_Phone_Number__c='+14154633840';        
        insert configSettings;
        Test.setMock(HttpCalloutMock.class, new Twilio_MockClass());

        System.Test.startTest();

        Twilio.sendfromtwilio(configSettings.Contact_Phone_Number__c,'test',con.Phone);
        twInstance.sendfromtwnx();
        twInstance.ok();

        System.Test.stopTest();
    }

    //this method for testing with names as "Nexmo"
    public static testmethod void testSmsFromTwnxWithNameAsNexmo(){        
        Contact con = new Contact(LastName='test',Phone='+19343213321');
        insert con;
        ApexPages.StandardController sc = new ApexPages.StandardController(con);
        Twnx twInstance = new Twnx(sc);
        configuration_setting__c configSettings= new configuration_setting__c();
        configSettings.Name='Nexmo';
        configSettings.AccountSid__c = 'accountId';
        configSettings.Active__c = true;
        configSettings.AuthToken__c ='auth002';
        configSettings.Bulk_SMS__c='+18559331384';
        configSettings.Contact_Phone_Number__c='+18559172384';
        configSettings.Lead_Phone_Number__c='+14154633840';      
        insert configSettings; 

        Test.setMock(HttpCalloutMock.class, new Nexmo_MockClass());

        System.Test.startTest();
        Nexmo.sendMessage( con.Phone,  configSettings.Contact_Phone_Number__c,  'text',  'sms');
        twInstance.sendfromtwnx();
        twInstance.ok();
        System.Test.stopTest();
    } }

Thanks inadvance.......................................

Aucun commentaire:

Enregistrer un commentaire