You need to sign in to do that
Don't have an account?

How to cover wrapper class coading inside test class ?
Hi all,
I am writing a test class. Wrapper class variable inside the method is not getting coverage. Bellow is my code. Bellow having my code. Fro line 22 to 30 didn't cover and 32 to 44 didn't cover.
I am writing a test class. Wrapper class variable inside the method is not getting coverage. Bellow is my code. Bellow having my code. Fro line 22 to 30 didn't cover and 32 to 44 didn't cover.
public void GoToCart(){ SearchRend=false; productRend=true; RendR = false; // Insert Quote QuoteVar = new Quote(); QuoteProductList = new List<Quote_Product__c>(); QuoteVar.Name=opp.Name; QuoteVar.OpportunityID=opp.id; QuoteVar.Status='Opened'; insert QuoteVar; qid=QuoteVar.id; QuoteVar=[Select id, name from Quote where id=:qid]; if(wrapPriceList != null){ for(wrapPrice wrapPriceObj : wrapPriceList) { //** Qoute Line Items section QuoteProduct = new Quote_product__c(); if(wrapPriceObj.selected == true) { QuoteProduct.Quote__c=QuoteVar.id; QuoteProduct.Price_Detail__c=wrapPriceObj.pds.id; QuoteProduct.Description__c=wrapPriceObj.pds.partNo__r.part_description__c; QuoteProduct.Operating_Model__c=wrapPriceObj.pds.Operating_Model__c; QuoteProduct.Buying_Price__c=wrapPriceObj.pds.Buying_Price__c; QuoteProduct.Type__c=wrapPriceObj.pds.Type__c; QuoteProduct.MSRP__c=wrapPriceObj.pds.MSRP__c; QuoteProduct.Insurance__c=wrapPriceObj.pds.Insurance__c; QuoteProduct.Insurance_Validity__c='12'; QuoteProductList.add(QuoteProduct); } }} if(walitems != null){ for(WalmartItems it1: walitems){ QuoteProduct = new Quote_product__c(); if(it1.selected == true){ QuoteProduct.Quote__c=QuoteVar.id; QuoteProduct.Description__c = it1.item.name; //QuoteProduct.Walmart_ItemId__c = it1.item.itemId; QuoteProduct.Buying_price__c = it1.item.saleprice; QuoteProductList.add(QuoteProduct); } } }else if(searchitems != null){ for(WalmartItems it1: searchitems){ QuoteProduct = new Quote_product__c(); if(it1.selected == true){ QuoteProduct.Quote__c=QuoteVar.id; QuoteProduct.Description__c = it1.item.name; //QuoteProduct.Walmart_ItemId__c = it1.item.itemId; QuoteProduct.Buying_price__c = it1.item.saleprice; QuoteProductList.add(QuoteProduct); } }} insert QuoteProductList; for(Quote_product__c ql:QuoteProductList ){ qpid.add(ql.id); } for(quote_product__c qp:[Select id, name,Buying_Price__c, Quantity__c, Discount__c, Insurance_Amount__c from Quote_product__C where id in :qpid]){ if(qp.Buying_Price__c == null){ continue; }else{ NetAmount=NetAmount+qp.Buying_price__c; } } selectedList = new List<price_details__c>(); for(wrapPrice wrapPriceObj : wrapPriceList) { if(wrapPriceObj.selected == true) { selectedList.add(wrapPriceObj.pds); //NetAmount=NetAmount+wrapPriceObj.pds.Buying_price__c; } } }
if you find out soluation, please post here. i am also facing same issue related to the wrapper class
Did you find the solution of this problem , please let me know if you solved it...i am also facing the same problem