<How to Mock a Web Service Endpoint for Unit Testi...
# stackoverflow
r
How to Mock a Web Service Endpoint for Unit Testing When the Endpoint is Unavailable in Development I am working on a Java project where I need to write unit tests with testng for a class that has a method similar to the following: public boolean isValidCode(String code) { // Some logic here return service.exists(new CodeInput(code)); } The isValidCode method calls a method exists from a service interface GenericService. The exists method in GenericService is responsible for checking the existence of a code. The issue I'm facing is that the exists method reaches out to an external...