• sapana.personal1.389616626807929E12
  • NEWBIE
  • 0 Points
  • Member since 2014

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

I have written a test method in my test class to test the after update event on Lead trigger. On update of the Lead record child Staff_Information__c record should be updated. The trigger is working fine. But my test method fails giving the following error 'Assertion Failed: Expected: Test FN, Actual: Update - Test First Name AS1'. But actually I am providing here the correct values. Could anyone point out what the mistake is? Here is my code.

@isTest(SeeAllData = true)
public static void Test_ENT_AdvisoryService_Triggers4()
  {
    // Initialise variables. 
    List<Lead> lstLeads = new List<Lead>();
    List<ENT_AS_Staff_Information__c> lstASStaffInformation = new List<ENT_AS_Staff_Information__c>();
    List<Lead> lstASLeadsToUpdate = new List<Lead>();
   
    Test.startTest();
   
    // Insert test Lead records.
    lstLeads = GenerateAdvisoryServicesTestLeads(100);
    System.assertEquals(lstLeads.size(),100);
   
    if(lstLeads != null && lstLeads.size() > 0)
    {
      lstASStaffInformation = GenerateTestASStaffInformationForLeads(lstLeads);
    }
       
    System.assertEquals(lstASStaffInformation.size(),100);
    System.assertEquals(lstASStaffInformation[0].Member_First_Name__c, 'Test FN');
     
    if(lstLeads != null && lstLeads.size() > 0)
    {
        for(Lead leadToUpdate: lstLeads)
        {    
            leadToUpdate.Additional_info_on_services__c = 'Update - Test Additional information on service';
            leadToUpdate.Expertise_of_key_personal__c = 'Update - Test Key Personal skills';
            leadToUpdate.Is_your_organization_registered_with_SAM__c  = 'No';
            leadToUpdate.Languages_conversationally__c = 'Update - English, Update - French';
            leadToUpdate.Languages_High_proficiency__c = 'Update - English';
            leadToUpdate.FirstName = 'Update - Test First Name AS1';
            leadToUpdate.LastName = 'Update - Test Last Name AS1';
            leadToUpdate.Job_Title__c = 'Update - Asset Manager';
            leadToUpdate.Experience_with_cities__c = 'Update - Columbia, Update - New York';
            leadToUpdate.Experience_with_coordination__c = 'Update - Test Description';
            leadToUpdate.Place_availability__c = 'Update - Columbia';
            leadToUpdate.Rate_support__c = 'Update - 60 USD for 1 day';
            leadToUpdate.References_name__c = 'Update - Test Reference';
            leadToUpdate.SAM_Expiration_Date__c = Date.today();              
            leadToUpdate.Company = 'Update - Test Company';
            leadToUpdate.Title = 'Test Title';
            leadToUpdate.Email = 'test@gmail.com';
            leadToUpdate.References_organization__c = 'Test Ref Org';
            leadToUpdate.References_email__c = 'testref@gmail.com';
            leadToUpdate.References_phone__c = '(401)-402-4433';
            leadToUpdate.References_title__c = 'Test Ref Title';
            leadToUpdate.Website = 'testweb.com';
            leadToUpdate.Contact_phone_number__c = '(456)-456-4567';
            leadToUpdate.Contact_Fax_Number__c = '(477)-477-7744';
            leadToUpdate.DUNS_Number__c = '12345';
            leadToUpdate.Federal_EIN__c  = '12345';
            leadToUpdate.Street = 'Test Street';
            leadToUpdate.City = 'Test City';
            leadToUpdate.State = 'NY';
            leadToUpdate.PostalCode = '54321-4321';
            leadToUpdate.Country = 'US';           
            lstASLeadsToUpdate.add(leadToUpdate); 
         } 
    } 
       
    // Check that list of updated Lead records is not empty and if not update the list.
    if(lstASLeadsToUpdate.size() > 0)
    {
        UPDATE lstASLeadsToUpdate;
    }
    System.assertEquals(lstASLeadsToUpdate.size(),100);
       
    // Update the related Staff Information record.
    if(lstASStaffInformation.size() > 0)
    {
        UPDATE lstASStaffInformation;
    }
    System.assertEquals(lstASStaffInformation.size(),100);
    // Check whether Staff Information records for Advisary Service Leads are updated.
    if(lstASStaffInformation.size()>0)
    {
        System.assertEquals(lstASStaffInformation[0].Member_first_name__c, 'Update - Test First Name AS1');
        System.assertEquals(lstASStaffInformation[0].Member_last_name__c, 'Update - Test Last Name AS1');
        System.assertEquals(lstASStaffInformation[0].Member_Title__c , 'Test Title');
        System.assertEquals(lstASStaffInformation[0].Rate_support__c, 'Update - 60 USD for 1 day');
        System.assertEquals(lstASStaffInformation[0].Selec_if_the_organization_is_registered__c,'No');
        System.assertEquals(lstASStaffInformation[0].Place_availability__c ,'Update - Columbia');
        System.assertEquals(lstASStaffInformation[0].Additional_info_on_services__c, 'Update - Test Additional information on service');
        System.assertEquals(lstASStaffInformation[0].Languages_high_profeciency__c,'Update - English' );
        System.assertEquals(lstASStaffInformation[0].Languages_conversationally__c,'Update - English, Update - French');
        System.assertEquals(lstASStaffInformation[0].Email__c,'test@gmail.com');
        System.assertEquals(lstASStaffInformation[0].Expertise_of_key_personnel__c,'Update - Test Key Personal skills');
        System.assertEquals(lstASStaffInformation[0].Narrative_Expertise_of_key_personal__c , 'Update - Test Key Personal skills');
        System.assertEquals(lstASStaffInformation[0].Narrative_Experience_with_cities__c, 'Update - Columbia, Update - New York');
        System.assertEquals(lstASStaffInformation[0].Narrative_Experience_with_coordination__c,'Update - Test Description');
        System.assertEquals(lstASStaffInformation[0].Reference_organization__c, 'Test Ref Org');
        System.assertEquals(lstASStaffInformation[0].Reference_email__c, 'testref@gmail.com');
        System.assertEquals(lstASStaffInformation[0].Reference_name__c,'Update - Test Reference');
        System.assertEquals(lstASStaffInformation[0].Reference_phone__c,'(401)-402-4433' );
        System.assertEquals(lstASStaffInformation[0].Reference_title__c,'Test Ref Title' );
        System.assertEquals(lstASStaffInformation[0].SAM_Expiration_Date__c,Date.today()) ;
        System.assertEquals(lstASStaffInformation[0].Website__c, 'testweb.com');
        System.assertEquals(lstASStaffInformation[0].Contact_phone_number__c,'(456)-456-4567');
        System.assertEquals(lstASStaffInformation[0].Contact_Fax_Number__c, '(477)-477-7744');
        System.assertEquals(lstASStaffInformation[0].DUNS_Number__c,'12345');
        System.assertEquals(lstASStaffInformation[0].Federal_EIN__c, '12345');
        System.assertEquals(lstASStaffInformation[0].Address__c ,String.valueOf('Test Street'+'Test City'+'NY'+'54321-4321'+'US'));
    }
        Test.stopTest();
  }
Hi,

I have written a test method in my test class to test the after update event on Lead trigger. On update of the Lead record child Staff_Information__c record should be updated. The trigger is working fine. But my test method fails giving the following error 'Assertion Failed: Expected: Test FN, Actual: Update - Test First Name AS1'. But actually I am providing here the correct values. Could anyone point out what the mistake is? Here is my code.

@isTest(SeeAllData = true)
public static void Test_ENT_AdvisoryService_Triggers4()
  {
    // Initialise variables. 
    List<Lead> lstLeads = new List<Lead>();
    List<ENT_AS_Staff_Information__c> lstASStaffInformation = new List<ENT_AS_Staff_Information__c>();
    List<Lead> lstASLeadsToUpdate = new List<Lead>();
   
    Test.startTest();
   
    // Insert test Lead records.
    lstLeads = GenerateAdvisoryServicesTestLeads(100);
    System.assertEquals(lstLeads.size(),100);
   
    if(lstLeads != null && lstLeads.size() > 0)
    {
      lstASStaffInformation = GenerateTestASStaffInformationForLeads(lstLeads);
    }
       
    System.assertEquals(lstASStaffInformation.size(),100);
    System.assertEquals(lstASStaffInformation[0].Member_First_Name__c, 'Test FN');
     
    if(lstLeads != null && lstLeads.size() > 0)
    {
        for(Lead leadToUpdate: lstLeads)
        {    
            leadToUpdate.Additional_info_on_services__c = 'Update - Test Additional information on service';
            leadToUpdate.Expertise_of_key_personal__c = 'Update - Test Key Personal skills';
            leadToUpdate.Is_your_organization_registered_with_SAM__c  = 'No';
            leadToUpdate.Languages_conversationally__c = 'Update - English, Update - French';
            leadToUpdate.Languages_High_proficiency__c = 'Update - English';
            leadToUpdate.FirstName = 'Update - Test First Name AS1';
            leadToUpdate.LastName = 'Update - Test Last Name AS1';
            leadToUpdate.Job_Title__c = 'Update - Asset Manager';
            leadToUpdate.Experience_with_cities__c = 'Update - Columbia, Update - New York';
            leadToUpdate.Experience_with_coordination__c = 'Update - Test Description';
            leadToUpdate.Place_availability__c = 'Update - Columbia';
            leadToUpdate.Rate_support__c = 'Update - 60 USD for 1 day';
            leadToUpdate.References_name__c = 'Update - Test Reference';
            leadToUpdate.SAM_Expiration_Date__c = Date.today();              
            leadToUpdate.Company = 'Update - Test Company';
            leadToUpdate.Title = 'Test Title';
            leadToUpdate.Email = 'test@gmail.com';
            leadToUpdate.References_organization__c = 'Test Ref Org';
            leadToUpdate.References_email__c = 'testref@gmail.com';
            leadToUpdate.References_phone__c = '(401)-402-4433';
            leadToUpdate.References_title__c = 'Test Ref Title';
            leadToUpdate.Website = 'testweb.com';
            leadToUpdate.Contact_phone_number__c = '(456)-456-4567';
            leadToUpdate.Contact_Fax_Number__c = '(477)-477-7744';
            leadToUpdate.DUNS_Number__c = '12345';
            leadToUpdate.Federal_EIN__c  = '12345';
            leadToUpdate.Street = 'Test Street';
            leadToUpdate.City = 'Test City';
            leadToUpdate.State = 'NY';
            leadToUpdate.PostalCode = '54321-4321';
            leadToUpdate.Country = 'US';           
            lstASLeadsToUpdate.add(leadToUpdate); 
         } 
    } 
       
    // Check that list of updated Lead records is not empty and if not update the list.
    if(lstASLeadsToUpdate.size() > 0)
    {
        UPDATE lstASLeadsToUpdate;
    }
    System.assertEquals(lstASLeadsToUpdate.size(),100);
       
    // Update the related Staff Information record.
    if(lstASStaffInformation.size() > 0)
    {
        UPDATE lstASStaffInformation;
    }
    System.assertEquals(lstASStaffInformation.size(),100);
    // Check whether Staff Information records for Advisary Service Leads are updated.
    if(lstASStaffInformation.size()>0)
    {
        System.assertEquals(lstASStaffInformation[0].Member_first_name__c, 'Update - Test First Name AS1');
        System.assertEquals(lstASStaffInformation[0].Member_last_name__c, 'Update - Test Last Name AS1');
        System.assertEquals(lstASStaffInformation[0].Member_Title__c , 'Test Title');
        System.assertEquals(lstASStaffInformation[0].Rate_support__c, 'Update - 60 USD for 1 day');
        System.assertEquals(lstASStaffInformation[0].Selec_if_the_organization_is_registered__c,'No');
        System.assertEquals(lstASStaffInformation[0].Place_availability__c ,'Update - Columbia');
        System.assertEquals(lstASStaffInformation[0].Additional_info_on_services__c, 'Update - Test Additional information on service');
        System.assertEquals(lstASStaffInformation[0].Languages_high_profeciency__c,'Update - English' );
        System.assertEquals(lstASStaffInformation[0].Languages_conversationally__c,'Update - English, Update - French');
        System.assertEquals(lstASStaffInformation[0].Email__c,'test@gmail.com');
        System.assertEquals(lstASStaffInformation[0].Expertise_of_key_personnel__c,'Update - Test Key Personal skills');
        System.assertEquals(lstASStaffInformation[0].Narrative_Expertise_of_key_personal__c , 'Update - Test Key Personal skills');
        System.assertEquals(lstASStaffInformation[0].Narrative_Experience_with_cities__c, 'Update - Columbia, Update - New York');
        System.assertEquals(lstASStaffInformation[0].Narrative_Experience_with_coordination__c,'Update - Test Description');
        System.assertEquals(lstASStaffInformation[0].Reference_organization__c, 'Test Ref Org');
        System.assertEquals(lstASStaffInformation[0].Reference_email__c, 'testref@gmail.com');
        System.assertEquals(lstASStaffInformation[0].Reference_name__c,'Update - Test Reference');
        System.assertEquals(lstASStaffInformation[0].Reference_phone__c,'(401)-402-4433' );
        System.assertEquals(lstASStaffInformation[0].Reference_title__c,'Test Ref Title' );
        System.assertEquals(lstASStaffInformation[0].SAM_Expiration_Date__c,Date.today()) ;
        System.assertEquals(lstASStaffInformation[0].Website__c, 'testweb.com');
        System.assertEquals(lstASStaffInformation[0].Contact_phone_number__c,'(456)-456-4567');
        System.assertEquals(lstASStaffInformation[0].Contact_Fax_Number__c, '(477)-477-7744');
        System.assertEquals(lstASStaffInformation[0].DUNS_Number__c,'12345');
        System.assertEquals(lstASStaffInformation[0].Federal_EIN__c, '12345');
        System.assertEquals(lstASStaffInformation[0].Address__c ,String.valueOf('Test Street'+'Test City'+'NY'+'54321-4321'+'US'));
    }
        Test.stopTest();
  }

Hi,

 

I'm trying to search and display Chatter Group feed using following query but it's throwing error

 

'Didn't understand relationship 'FeedItem' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names'

 

Select FeedItem.Body, FeedItem.Title, FeedItem.Type From CollaborationGroupFeed u where parentid=''

 

same query is mentioned in Chatter Cheat Sheet.

 

How can I get it working?

 

Thanks & Regards

-Kunjan