From the course: Spring: Spring MVC

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Testing the @ExceptionHandler with the @ResponseEntity

Testing the @ExceptionHandler with the @ResponseEntity

From the course: Spring: Spring MVC

Start my 1-month free trial

Testing the @ExceptionHandler with the @ResponseEntity

- So let's now go to Postman tool and test out the three cases that we have. So I'm going to create a new request. Let's say http://localhost8080/hplus/thatsrest and then we have login user, that's the service that we want to test. So let's go back to the ID and confirm that we are accessing the correct URL pattern. Yeah, that's the one. Now we'll first test the success case, which will give us a response of everything is okay, and then let's test the other ones. So this will change to post, of course. And then we have to send a request body, this is a post request, which means the information that you want to send along with the service will go in the body. So I'm just going to click on body, select a row, and select application Jason as the format of the data in the request body. So let's provide a Jason, the Jason will look like this. It will have two fields, username: that is admin, and then you have password…

Contents