+ Start a Discussion
satya G 4satya G 4 

Hi,How to pass -ve values in test class,"getParentId()" this is another method with parameter and this method is assigned to "parent variable" and check with -ve values

,here is my code :Integer parent= getParentId(s.Forum_Year__r.Year__c ,auth.getAccessToken(),auth);
                if (!(parent>0))
                    throw new WordpressException('Parent does not exist');
                obj.parent=parent ;
                if (!String.isEmpty(s.Session_Type__c)) {
                    Integer etype= lookupEvent(s.Session_Type__c,auth.getAccessToken(), auth);
                    List<Integer> evlst=new List<Integer>();

Hi satya,

If this is integration try to build the body for JSON format in test am implement the method WebServiceMock 

see this link :



satya G 4satya G 4
Yeah,This class is REST based ,i created mockresponse for this class,but in the first method above code is not covered..,so how to pass the -ve values in test class.,i mean how to cover the if condition.

Thank you

Hi satya h

are you getting the values for getParentId() ? if not pass some dummy values to this method by calling this method