Close
« Tutorial

Spring MVC - Testing PUT Requests MCQ

0/13
0 ✓
0 ✗

1. What is the main benefit of using Spring MVC test support to test a controller?

2. What is the typical purpose of an HTTP PUT request?

3. Which HTTP header tells the server the format of the data sent in the request body?

4. Which HTTP header tells the server what response format the client wants?

5. Which annotation tells Spring MVC to convert the request body into a method parameter?

6. Which component converts a JSON or XML request body into a Java object in Spring MVC?

7. Which media type is used for form data sent in a request body as name-value pairs?

8. Which request body is a correct form-encoded value for two fields: id with value 3, and content with value hello?

9. A controller method uses @RequestBody to receive all form fields. Which parameter type can hold them, including fields with several values?

@PutMapping("/{id}")
@ResponseBody
public String update(@RequestBody ??? formParams) { ... }

10. What does the consumes attribute of @PutMapping do?

11. A client sends a request with a content type that no controller method accepts. Which HTTP status does Spring MVC usually return?

12. Which annotation can load a web application context for a JUnit 5 Spring MVC test class?

13. Which Spring class gives you an AssertJ-style API to test MVC controllers without a running server?

14. A controller method has @ResponseBody and returns a String. How does Spring MVC treat the returned value?

Join