• DTRain521
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 12
    Replies

Hi all,

The following code is almost covered but I need some help with covering some of the code that I dont know how to right coverage for.  Below is the class and test class in the class there is reference to disablexxx = true; and xxxQuoteValue = true;  I need to cover these in my test class.  There is an attempt to cover in the test class but something is not written right.

 

Any help would be great.

 

Class:  disableAuto and such refers to items on my vf page.

 

        if(l.Consumer_Products__c == auto)
        {
            disableAuto = true;
            disableHome = true;
            disableUmbrella = true;
            disableBoat = true;
            disableDwellingFire = true;
            disableThirdParty = true;
            autoQuoteValue = true;
        }
        

 

 

test class:  note the "clc.autoQuoteValue = true;"  running test shows that it is not covered.

 

ApexPages.currentPage().getParameters().put('id', lead.Id);
            ApexPages.StandardController sc = new ApexPages.StandardController(lead);
            Test.startTest();
    
            ConvertLeadController clc = new ConvertLeadController(sc);
            clc.autoQuoteValue = true;
            clc.boatQuoteValue = true;
            clc.dwellingFireQuoteValue = true;
            clc.homeQuoteValue = true;
            clc.thirdPartyQuoteValue = true;
            clc.convertLead();
            

 Thanks in Advance,

Dwayne

 

Hi,

Need so help with the following code.  

tooltip4 needs to reference the public void addUpsellHome.  Not sure if I wrote this the best way.  What I need from it is to query a custom object, determine which record to return then return the string result to tooltip4.

 

Code is below:

 

 

public void addUpsellHome(String infoPIPCov) 
    {
    		List<PIP__c> returnPIPCov = new List<PIP__c>();
    		String PIPInfo;
    		String PIPInfoState;
    		tempCovPIP = 'Upsell - EFT';
    		for (PIP__c pip : [select SystemModstamp, RecordTypeId, PIP_Upsell_Coverage__c, PIP_State__c, PIP_Information__c, 
    					OwnerId, Name, LastModifiedDate, LastModifiedById, IsDeleted, Id, CreatedDate, CreatedById 
    					from PIP__c 
    					where PIP_Upsell_Coverage__c =: tempCovPIP]){
    						
    			if(pip.PIP_State__c != null)
    				PIPInfoState = pip.Name + ': ' + pip.PIP_State__c + ': ' + pip.CreatedById;
    			else
    				PIPInfo = pip.Name + ': ' + pip.RecordTypeId + ': ' + pip.CreatedById;
    			
    		}
    		if ( PIPInfoState != null) 
				return String.valueOF(PIPInfoState);
			else 
				return String.valueOF(PIPInfo);
    }
    
    public String tooltip4 {
        get{
            String returnVal = '';
            returnVal += ((String) infoPIPCov == null? '[None]': infoPIPCov) + '<br/>';
            	return returnVal;
        }
        set{
            tooltip4 = value;
        }
    }

 Any Help would be great.

Thanks Dwayne

 

Hello,

What would be the best way to display a message while a trigger runs on a Lead before insert or update?  Preferably I would like to have a message display that provides a decision of yes or no.  Yes would return them to the lead record to make other updates, no would save the record.

 

Any help to point me in the right direction would be great.  Code reference would be great.  It seems I learn better from existing code.  :)

Thanks Dwayne

Hi everyone,

I am having an issue with a test class.  During the System.assertEquals() process I am getting an External Entry Error.

 

I am new at developing and could use your experteise on this issue.  My code is shown below.

 

 

@isTest
class TestConvertCLLeadController
{
    final static String clauto = 'CL Auto';
    
    static testMethod void testConvertCLLeadController()
    {
        //We run our unit test as this user
        User testSysAdminUser = new User(alias = 'standt', email='standarduser@testorg.com', 
            emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US', 
            localesidkey='en_US', profileId = [select id from profile where name='System Administrator' LIMIT 1].Id, 
            timezonesidkey='America/Los_Angeles', username='ASstandarduser@testorg.com');
            
        insert testSysAdminUser;
        
        System.runAs(testSysAdminUser)
        {
            Lead lead = new lead (LastName = 'TEST1',
                                  Company = 'TEST1',
                                  OwnerId = UserInfo.getUserId(),
                                  Consumer_Products__c = clauto,
                                  Agent_Code__c = 'TEST1',
                                  Email = 'test@test.com',
                                  Billing_Street__c = '1234 W TEST AVE',
                                  Billing_City__c = 'Boston');
                                 
            insert lead;
            
            ApexPages.currentPage().getParameters().put('id', lead.Id);
            ApexPages.StandardController sc = new ApexPages.StandardController(lead);
            Test.startTest();
    
            ConvertCLLeadController clc = new ConvertCLLeadController(sc);
            clc.clautoQuoteValue = true;

            clc.convertLead();
            
            Id accountId = [SELECT ConvertedAccountId FROM Lead WHERE Id =: lead.Id].ConvertedAccountId;
error occurs at this point..........
            System.assertEquals(6, [SELECT count() FROM Opportunity WHERE AccountId =: accountId]);
            System.assertEquals(0, [SELECT count() FROM Contact WHERE AccountId =: accountId]);

 

 

Thanks You so much for your help.

Dwayne

Hi, I have a need for a button from a VF page to rediert me to the landing page for record type selection for creating a new record on a custom object. Custom object has a master detail relationship with Opportunity. I have created the button but need help with the APEX coding in the class for the VF page. Any help would be greatful. Thanks Dwayne

Hi all,

The following code is almost covered but I need some help with covering some of the code that I dont know how to right coverage for.  Below is the class and test class in the class there is reference to disablexxx = true; and xxxQuoteValue = true;  I need to cover these in my test class.  There is an attempt to cover in the test class but something is not written right.

 

Any help would be great.

 

Class:  disableAuto and such refers to items on my vf page.

 

        if(l.Consumer_Products__c == auto)
        {
            disableAuto = true;
            disableHome = true;
            disableUmbrella = true;
            disableBoat = true;
            disableDwellingFire = true;
            disableThirdParty = true;
            autoQuoteValue = true;
        }
        

 

 

test class:  note the "clc.autoQuoteValue = true;"  running test shows that it is not covered.

 

ApexPages.currentPage().getParameters().put('id', lead.Id);
            ApexPages.StandardController sc = new ApexPages.StandardController(lead);
            Test.startTest();
    
            ConvertLeadController clc = new ConvertLeadController(sc);
            clc.autoQuoteValue = true;
            clc.boatQuoteValue = true;
            clc.dwellingFireQuoteValue = true;
            clc.homeQuoteValue = true;
            clc.thirdPartyQuoteValue = true;
            clc.convertLead();
            

 Thanks in Advance,

Dwayne

 

Hi,

Need so help with the following code.  

tooltip4 needs to reference the public void addUpsellHome.  Not sure if I wrote this the best way.  What I need from it is to query a custom object, determine which record to return then return the string result to tooltip4.

 

Code is below:

 

 

public void addUpsellHome(String infoPIPCov) 
    {
    		List<PIP__c> returnPIPCov = new List<PIP__c>();
    		String PIPInfo;
    		String PIPInfoState;
    		tempCovPIP = 'Upsell - EFT';
    		for (PIP__c pip : [select SystemModstamp, RecordTypeId, PIP_Upsell_Coverage__c, PIP_State__c, PIP_Information__c, 
    					OwnerId, Name, LastModifiedDate, LastModifiedById, IsDeleted, Id, CreatedDate, CreatedById 
    					from PIP__c 
    					where PIP_Upsell_Coverage__c =: tempCovPIP]){
    						
    			if(pip.PIP_State__c != null)
    				PIPInfoState = pip.Name + ': ' + pip.PIP_State__c + ': ' + pip.CreatedById;
    			else
    				PIPInfo = pip.Name + ': ' + pip.RecordTypeId + ': ' + pip.CreatedById;
    			
    		}
    		if ( PIPInfoState != null) 
				return String.valueOF(PIPInfoState);
			else 
				return String.valueOF(PIPInfo);
    }
    
    public String tooltip4 {
        get{
            String returnVal = '';
            returnVal += ((String) infoPIPCov == null? '[None]': infoPIPCov) + '<br/>';
            	return returnVal;
        }
        set{
            tooltip4 = value;
        }
    }

 Any Help would be great.

Thanks Dwayne

 

Hello,

What would be the best way to display a message while a trigger runs on a Lead before insert or update?  Preferably I would like to have a message display that provides a decision of yes or no.  Yes would return them to the lead record to make other updates, no would save the record.

 

Any help to point me in the right direction would be great.  Code reference would be great.  It seems I learn better from existing code.  :)

Thanks Dwayne

Hi everyone,

I am having an issue with a test class.  During the System.assertEquals() process I am getting an External Entry Error.

 

I am new at developing and could use your experteise on this issue.  My code is shown below.

 

 

@isTest
class TestConvertCLLeadController
{
    final static String clauto = 'CL Auto';
    
    static testMethod void testConvertCLLeadController()
    {
        //We run our unit test as this user
        User testSysAdminUser = new User(alias = 'standt', email='standarduser@testorg.com', 
            emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US', 
            localesidkey='en_US', profileId = [select id from profile where name='System Administrator' LIMIT 1].Id, 
            timezonesidkey='America/Los_Angeles', username='ASstandarduser@testorg.com');
            
        insert testSysAdminUser;
        
        System.runAs(testSysAdminUser)
        {
            Lead lead = new lead (LastName = 'TEST1',
                                  Company = 'TEST1',
                                  OwnerId = UserInfo.getUserId(),
                                  Consumer_Products__c = clauto,
                                  Agent_Code__c = 'TEST1',
                                  Email = 'test@test.com',
                                  Billing_Street__c = '1234 W TEST AVE',
                                  Billing_City__c = 'Boston');
                                 
            insert lead;
            
            ApexPages.currentPage().getParameters().put('id', lead.Id);
            ApexPages.StandardController sc = new ApexPages.StandardController(lead);
            Test.startTest();
    
            ConvertCLLeadController clc = new ConvertCLLeadController(sc);
            clc.clautoQuoteValue = true;

            clc.convertLead();
            
            Id accountId = [SELECT ConvertedAccountId FROM Lead WHERE Id =: lead.Id].ConvertedAccountId;
error occurs at this point..........
            System.assertEquals(6, [SELECT count() FROM Opportunity WHERE AccountId =: accountId]);
            System.assertEquals(0, [SELECT count() FROM Contact WHERE AccountId =: accountId]);

 

 

Thanks You so much for your help.

Dwayne

Hi, I have a need for a button from a VF page to rediert me to the landing page for record type selection for creating a new record on a custom object. Custom object has a master detail relationship with Opportunity. I have created the button but need help with the APEX coding in the class for the VF page. Any help would be greatful. Thanks Dwayne