You need to sign in to do that
Don't have an account?
Coolday
How to write the test class for this piece of code?
Code
if(response.getStatusCode() != 200){ exception e = new exception(); e.setMessage(response.toString()); HandleCustomException.LogException(e,payload,null); }
As mentioned in the below article you can use mock class and set the statucode there.
https://jayakrishnasfdc.wordpress.com/2021/01/02/apex-test-class-examples-for-web-services/
If this solution helps, Please mark it as best answer.
Thanks,