Complete the code to create a Problem Details response with a title.
ProblemDetail problem = ProblemDetail.forStatus(HttpStatus.BAD_REQUEST); problem.set[1]("Invalid input");
The setTitle method sets the title of the problem detail, which describes the error briefly.
Complete the code to add a detailed error message to the ProblemDetail.
problem.set[1]("The provided ID is not valid.");
The setDetail method adds a detailed explanation about the error.
Fix the error in setting the HTTP status code for the ProblemDetail.
problem.setStatus(HttpStatus.[1]);The setStatus method expects an HttpStatus enum value, not an int or method call.
Fill both blanks to create a ProblemDetail with a custom type URI and instance URI.
problem.set[1](URI.create("https://example.com/probs/invalid-input")); problem.set[2](URI.create("/orders/1234"));
setType sets a URI identifying the error type.setInstance sets a URI identifying the specific occurrence of the problem.
Fill all three blanks to create a ProblemDetail with title, detail, and status.
problem.set[1]("Unauthorized access"); problem.set[2]("You must log in to access this resource."); problem.set[3](HttpStatus.UNAUTHORIZED);
setTitle sets the short error title.setDetail sets the detailed message.setStatus sets the HTTP status code.