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
From the course: Spring: Spring MVC
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
RESTful services recap5m 19s
-
(Locked)
Use @Controller and @ResponseBody5m 14s
-
(Locked)
Use @RequestController and @ResponseEntity4m 27s
-
(Locked)
Use @PathVariable and @RequestParam to get request payload3m 51s
-
(Locked)
Use @RequestBody and @ResponseEntity5m 18s
-
(Locked)
Use @ExceptionHandler3m 27s
-
(Locked)
Testing the @ExceptionHandler with the @ResponseEntity5m 35s
-
(Locked)
MVC vs. REST controllers1m 22s
-
(Locked)
-