You need to sign in to do that
Don't have an account?
maiyaku
Test Class is not check something in the loop.
I get ID from java script, but test class is not work.
It is not error, but can not check something in the loop. How do I fix it.
Class
Public String OppID = ApexPages.currentPage().getParameters().get('Oppid'); List<Delivery__c> lsttmpDL = new List<Delivery__c>(); public PageReference SaveDelivery(){ if(OppID != null){ //Pass for(Delivery__c DL : Deliverys){ /////////////////////////// Faild this test class not work. Can not check in the loop. Delivery__c tmpDL = New Delivery__c (); tmpDL.Ship_To_Account__c = DL.Ship_To_Account__c; tmpDL.Order_Taking__c = DL.Order_Taking__c ; tmpDL.Order_Reference__c = DL.Order_Reference__c ; tmpDL.Reference__c = DL.Reference__c; tmpDL.Est_Completed__c = DL.Est_Completed__c; tmpDL.PO_No__c = DL.PO_No__c; tmpDL.PO_Date__c = DL.PO_Date__c; tmpDL.Transfer_Date__c = DL.Transfer_Date__c; tmpDL.Discount_Order__c = DL.Discount_Order__c; tmpDL.Discount_Code_1__c = DL.Discount_Code_1__c; tmpDL.Remark__c = DL.Remark__c; lsttmpDL.Add(tmpDL); } insert lsttmpDL ; } }
Test Class
List<Delivery__c > objdelivery = new List<Delivery__c >(); ApexPages.StandardSetController controller = new ApexPages.StandardSetController(objdelivery); DeliveryPages clsTest = new DeliveryPages(controller); Order_Taking__c OT = New Order_Taking__c(); OT.Periods_of_Order__c = 4; insert OT; ApexPages.currentPage().getParameters().put('OppID', OT.Id); Delivery__c DL = New Delivery__c(); DL.Salesman_Code__c = '12344576'; DL.Order_Taking__c = OT.id; Insert DL; List<Delivery__c> lstDeliverys = new List<Delivery__c>(); lstDeliverys.Add(DL);
ApexPages.currentPage().getParameters().get('OppID');
clsTest.ShowDeliverys();
Best, Regards.
Hi
Please Insert all the values of Delivery object in test class .
Ship_To_Account__c
Order_Reference__c
Discount_Order__c
Discount_Code_1__c
Like wise ....
Did this post solve your problem..if so please mark it solved ...so that others get benifited
Thanks
asish