debugging - Is it possible for an SFDC Apex unit test to parse a debug log? -


i'm playing around sfdc-http integration , new mock server functionality.

in apex code testing, have branch condition:

if (response.getstatuscode() != 200) { debugresponse (response); }         else { update (processinvoicelist(invoiceidlist, response)); }   

... , can thoroughly test happens if status code 200.

however, if status code not 200, code executed this:

 /**  * write debugging information  * @param httpresponse response : http response (e.g., sendjsontoremoteservice())  * @return none  **/ private static void debugresponse (httpresponse response) {     system.debug(                                                                    logginglevel.error ,                  '!!!!! error ' + request.getendpoint() + ' : ' + response.getstatuscode() + ' ' + response.getstatus()                 );  } 

this being case, code stands, changes made system check check debug log.

i realize refactor source expose httpresponse (i.e. make public class variable), aside testing there no need expose it, don't want if don't need to.

so, instead, i'd unit test parse error log error message.

is possible?

if so, how?


Comments