You need to sign in to do that
Don't have an account?
Rahul Mehata
Not able to cover the lines
Hello,
I am not able to cover the below lines un test class. Can some one help please .
if(orderWrap.isSuccess == False && returnWrap.isSuccess == True ) {
CS_SAPSFShipToOrderParser.shipToOrder orderItemWrap = new CS_SAPSFShipToOrderParser.shipToOrder();
List< CS_SAPSFShipToOrderParser.OrderList> orderListWrap = new List<CS_SAPSFShipToOrderParser.OrderList>();
for(CS_SAPSFShipToReturnOrderParser.ReturnOrderResults forwrap : returnWrap.d.results){
CS_SAPSFShipToOrderParser.OrderList oWrap = new CS_SAPSFShipToOrderParser.OrderList();
oWrap.formattedDeliveryBlockReason = forwrap.formattedDeliveryBlockReason;
oWrap.formattedCreationDate = forwrap.formattedCreationDate;
oWrap.formattedDeliveryDate = forwrap.formattedDeliveryDate;
oWrap.formattedHeaderBillingBlockReason = forwrap.formattedHeaderBillingBlockReason;
oWrap.formattedpurchaseOrderByCustomer = forwrap.formattedpurchaseOrderByCustomer;
oWrap.formattedDeliveryDate = forwrap.formattedDeliveryDate;
oWrap.formattedSalesOrderType = forwrap.formattedCustomerReturnType;
oWrap.formattedtotalNetAmount = forwrap.formattedtotalNetAmount;
oWrap.formattedOverallSDProcessStatus = forwrap.formattedOverallSDProcessStatus;
oWrap.salesOrder = forwrap.customerReturn;
orderListWrap.add(oWrap);
}
orderItemWrap.results = orderListWrap;
orderWrap.d = orderItemWrap;
orderWrap.checkForError = Label.CS_Orders + orderWrap.errorMessage;
orderWrap.checkForSuccess = True;
}
I am not able to cover the below lines un test class. Can some one help please .
if(orderWrap.isSuccess == False && returnWrap.isSuccess == True ) {
CS_SAPSFShipToOrderParser.shipToOrder orderItemWrap = new CS_SAPSFShipToOrderParser.shipToOrder();
List< CS_SAPSFShipToOrderParser.OrderList> orderListWrap = new List<CS_SAPSFShipToOrderParser.OrderList>();
for(CS_SAPSFShipToReturnOrderParser.ReturnOrderResults forwrap : returnWrap.d.results){
CS_SAPSFShipToOrderParser.OrderList oWrap = new CS_SAPSFShipToOrderParser.OrderList();
oWrap.formattedDeliveryBlockReason = forwrap.formattedDeliveryBlockReason;
oWrap.formattedCreationDate = forwrap.formattedCreationDate;
oWrap.formattedDeliveryDate = forwrap.formattedDeliveryDate;
oWrap.formattedHeaderBillingBlockReason = forwrap.formattedHeaderBillingBlockReason;
oWrap.formattedpurchaseOrderByCustomer = forwrap.formattedpurchaseOrderByCustomer;
oWrap.formattedDeliveryDate = forwrap.formattedDeliveryDate;
oWrap.formattedSalesOrderType = forwrap.formattedCustomerReturnType;
oWrap.formattedtotalNetAmount = forwrap.formattedtotalNetAmount;
oWrap.formattedOverallSDProcessStatus = forwrap.formattedOverallSDProcessStatus;
oWrap.salesOrder = forwrap.customerReturn;
orderListWrap.add(oWrap);
}
orderItemWrap.results = orderListWrap;
orderWrap.d = orderItemWrap;
orderWrap.checkForError = Label.CS_Orders + orderWrap.errorMessage;
orderWrap.checkForSuccess = True;
}
The code provided in question does not highlight which lines of class are uncovered. Since this code requires an understanding of your implementation, it might not be possible to provide exact edit suggestions. However, the below articles give a good insight into how coverage can be improved and get started
https://salesforce.stackexchange.com/questions/244794/how-do-i-increase-my-code-coverage-or-why-cant-i-cover-these-lines
https://salesforce.stackexchange.com/questions/244788/how-do-i-write-an-apex-unit-test
Examples of wrapper class test classes:
https://salesforce.stackexchange.com/questions/377896/how-to-get-test-coverage-on-a-simple-wrapper-class
https://salesforce.stackexchange.com/questions/335633/need-help-on-apex-test-class-for-wrapper-class
If this information helps, please mark the answer as best. Thank you