• Marc G.ax1040
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies

Hi , 

 

I need help in fixing the assertion issue in this test class. I have 2 objects with Start_Term__c fields on both  Opportuntiy and Contact respectively . My trigger basicallly updates the Start_Term__c  field on contact.

 ***************************************************************************************/

@isTest 
private class opportunity_syncStartTermTest
{
	
         static testmethod void test()
         {
          Contact newcontact = new Contact(LastName = 'abc',
	 			           Start_Term__c = 'Jan 2012'
	 				   );
	    insert newcontact;
	 Opportunity newopportunity = new Opportunity( Contact__c = newcontact.Id,
	  						Name = 'abc',
		         				StageName = 'StageName',
							Start_Term__c = 'Jan 2012',
							CloseDate = Date.today()
							 );
          insert newopportunity;
		   Test.startTest();
            newopportunity.Start_Term__c = 'Sep 2011';
            update newopportunity; 
           Test.stopTest();
            Contact[] message = [SELECT Id, Start_Term__c,Program_Primary__c FROM Contact WHERE ID = :newcontact.Id limit 1]; 
            if(message.size() > 0)
            {
                System.assert(message[0].Start_Term__c == 'Sep 2011');  
             }
       
        }
      
}


}

 Thanks for your help

HI,
I am using change set to deploy my code to production so before i do that , i am validatingn my code.
Then, when i validate the components which includes a visual force page, apex class and test class for that apex class it says validtion failed bcos of an error. What's confusing me is why is the validation failing bcos of a completely different test class which i m not working with. Is this error because of pre- existing failure of test case or if  really my code is causing this error. 
My unit test cover 95% of code. Please help

Hi , 

 

I need help in fixing the assertion issue in this test class. I have 2 objects with Start_Term__c fields on both  Opportuntiy and Contact respectively . My trigger basicallly updates the Start_Term__c  field on contact.

 ***************************************************************************************/

@isTest 
private class opportunity_syncStartTermTest
{
	
         static testmethod void test()
         {
          Contact newcontact = new Contact(LastName = 'abc',
	 			           Start_Term__c = 'Jan 2012'
	 				   );
	    insert newcontact;
	 Opportunity newopportunity = new Opportunity( Contact__c = newcontact.Id,
	  						Name = 'abc',
		         				StageName = 'StageName',
							Start_Term__c = 'Jan 2012',
							CloseDate = Date.today()
							 );
          insert newopportunity;
		   Test.startTest();
            newopportunity.Start_Term__c = 'Sep 2011';
            update newopportunity; 
           Test.stopTest();
            Contact[] message = [SELECT Id, Start_Term__c,Program_Primary__c FROM Contact WHERE ID = :newcontact.Id limit 1]; 
            if(message.size() > 0)
            {
                System.assert(message[0].Start_Term__c == 'Sep 2011');  
             }
       
        }
      
}


}

 Thanks for your help

I have an object called "Lease".When i create a record in Lease  it  gets saved.I should have a button  "Generate Office " in the record which automatically creates an office record which is exactly same as record created earlier in Lease

 

In " office" all the fields which are there in "lease" are present and also they are formula fields

 

 

I am in a confusion as i didnot understand d req properly or how do i need approach

 

 

Do i need to visual force page for the button

hi,

 I want to add a custom button in Related List.

 for example  I have a custom button named add in contact and i want that button in account  Related List.

  • March 26, 2011
  • Like
  • 0