My apex class is
tempinvoiceid = apexpages.currentpage().getparameters().get('tempinvoiceid');
tempin = [select name,Invoice_contact__c,First_Name__c,State__c,Invoice_policy__c,Invoice_Check__c,Last_Name__c,country__c,Email__c from Invoice__c where id=:tempInvoiceid];
paypolicy = [select id,Early_Days__c,early_Payment__c, invoice_policy__c from payment_policy__c where early_payment__c = true and invoice_policy__c = :tempin[0].Invoice_policy__c]; //getting error here
My test class is
public static testmethod void testsitepage(){
test.starttest();
Invoice_Policy__c newpolicy = new Invoice_policy__c(name='testPolicy',net__c='3',policy_status__c='Active');
insert newpolicy;
system.debug('newpolicyy'+newpolicy);
payment_policy__c newpay = new payment_policy__c(name='testEarlyPayment',early_payment__c = true,Early_Days__c='2',Invoice_Policy__c = newpolicy.id);
insert newpay;
Invoice__c newIn = new Invoice__c(First_Name__c = 'test',state__c='Hyderabad', Invoice_policy__c=newpolicy.id);
insert newIn;
apexpages.currentpage().getParameters().put('id',newpolicy.id);
sitepage sp = new sitepage();
etc.......
}
Invoice__c -------- Invoice_policy__c(lookup) payment_policy__c --------- Invoice_policy__c(lookup)
Help!!!!
payment_policy__cisinvoice_policy__cbut in the test it'sInvoice_Polici__c. Typo or you really have 2 similar fields? – eyescream Jan 17 at 8:03