trigger
trigger cptmpaddtoperadd on Student__c (before insert,before update)
{
for(student__c s: Trigger.new)
{
if (s.Copy_temp_addr_to_perminant_address__c )
{
s.Perminant_address__c=s.Temp_address__c; // getting not covered at this point
}
}
}
test class :
@istest
public class testcopytmptoper
{
static testmethod void copytmptoper()
{
Training__c t = new Training__c();
t.Name = 'cptmptoper';
insert t;
Batch__c b = new Batch__c();
b.Training__c = t.Id;
insert b;
student__c std = new student__c();
std.Batch__c = b.Id;
std.Name = 'krish';
if(std.Copy_temp_addr_to_perminant_address__c == true)
std.Temp_address__c = 'hyderabad';
insert std;
list<student__c> ss = [select id,Temp_address__c,Perminant_address__c from student__c where id =:std.Id];
system.assertEquals(ss[0].Perminant_address__c,ss[0].Temp_address__c);
}
}
can anyone help me with this ...!!! Thanks in advance.