• kesava Mallikarjuna 10
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi Everyone,

Can anyone help me in test class.
I have an error in test method assert .

User-added image
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();
    }
}

 
  • February 28, 2020
  • Like
  • 0

Hi, I'm new to apex. I need to make a form that has a "search" button where an ID is entered. With that id it connects to an api rest (https://swapi.co/api/people/'ID HERE '/) and returns information. I only need the following information: Name, Height, Gender, Hair Color, Eye Color, URL, Planet and the Character Number. I want to keep that information in a custom object "characeter__c". Would you help me? Everything done with aura framework