I am currently trying to automate some of the testing for my application using JUnit. My application has a method which calls a 3rd party REST API. I need to check if that method is handling HTTP status codes like 404 without actually calling the 4rd party API.
e.g., My Method:
public int getNumUsers(){
//call the 3rd party API - https://example.com/api/users/count
//return user count
}
I need to test if the method getNumUsers is handling HTTP status code 404 which could be returned by the 3rd party API - https://example.com/api/users/count.
Any suggestions?