Question 1
What is the primary use of TestRestTemplate in Spring Boot testing?
To mock HTTP requests
To perform integration testing of REST APIs by making real HTTP calls
To validate JSON schemas only
To test only repository layers
Question 2
Which annotation is typically used with TestRestTemplate to start the server on a random port for testing?
@WebMvcTest
@EnableRestTemplate
@RestTest
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
Question 3
How do you inject a TestRestTemplate instance into a test class?
new TestRestTemplate()
@Autowired TestRestTemplate restTemplate;
@TestRestTemplate
@InjectTestRestTemplate
Question 4
Which method of TestRestTemplate is used to perform a GET request?
get()
exchange()
getForEntity()
requestGet()
Question 5
Which statement about TestRestTemplate is TRUE?
It is a replacement for RestTemplate in production code
It is specifically designed for integration testing in Spring Boot
It can only be used with @WebMvcTest
It does not support POST requests
There are 5 questions to complete.