Spring RestTemplate invoking webservice with errors and analyze status code
You need to implement ResponseErrorHandler in order to intercept response code, body, and header when you get non-2xx response codes from the service using rest template. Copy all the information you need, attach it to your custom exception and throw it so that you can catch it in your test. public class CustomResponseErrorHandler implements ResponseErrorHandler … Read more