+ Start a Discussion
Math110Math110 

Can anyone help me to get code coverage for the following code

public void createorderline()
    {
        if(orderid == '' && orderid == null)
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Please save the Order to proceed..'));
        else {
          orderline__c ol =new orderline__c();
          ol.Status__c ='Pending Submission';
    if(ol.Order_Price__r.product__r.name!=null)
          oderlinelist.add(new neworderlist(ol,ol.Order_Price__r.product__r.name,0.0,0.0));
   else {
    system.debug('inside else*************');
string temp='';
     oderlinelist.add(new neworderlist(ol,temp,0.0,0.0));  
 }

          }
    }



Thanks much in advance...


ryanjuptonryanjupton

Math110, 

I think you need to provide a little more detail about your schema before one could deduce what a test class would look like. Especially since it looks like everything but Product is a custom object.

Have you already tried writing the test? If so, please post it and indicate any errors you are getting from it.

 

Thanks!

ryanjuptonryanjupton

BTW, could you also please explain why you posted to Java Development? If it's not Java related I'm going to move it to Apex Code Development.

 

Thanks!

Math110Math110
Since am new to this discussion board, mistakenly I had posted in that, sorry and thanks for moving it to apex code development.
ryanjuptonryanjupton
Not a problem. I think it will be better addressed there.