-
Notifications
You must be signed in to change notification settings - Fork 770
Open
Description
need to avoid org.springframework.web.bind.annotation
- https://github.com/spring-projects/spring-boot/blob/13cf6669489f1b858dbb0732b72bee4ea8cbf71e/smoke-test/spring-boot-smoke-test-test/src/main/java/smoketest/test/web/UserVehicleController.java#L65
UnusedMethodnot recognize annotated EndPoints #5281
> Task :smoke-test:spring-boot-smoke-test-test:compileJava FAILED
/Users/vincent.potucek/IdeaProjects/spring-boot/smoke-test/spring-boot-smoke-test-test/src/main/java/smoketest/test/web/UserVehicleController.java:65: warning: [UnusedMethod] Method 'handleVinNotFound' is never used.
private void handleVinNotFound(VehicleIdentificationNumberNotFoundException ex) {
^
(see https://errorprone.info/bugpattern/UnusedMethod)
Did you mean to remove this line?
error: warnings found and -Werror specified
1 error
1 warning
package smoketest.test.web;
import smoketest.test.domain.User;
import smoketest.test.service.VehicleDetails;
import smoketest.test.service.VehicleIdentificationNumberNotFoundException;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
/**
* Controller to return vehicle information for a given {@link User}.
*
* @author Phillip Webb
*/
@RestController
public class UserVehicleController {
private final UserVehicleService userVehicleService;
public UserVehicleController(UserVehicleService userVehicleService) {
this.userVehicleService = userVehicleService;
}
@GetMapping(path = "/{username}/vehicle", produces = MediaType.TEXT_PLAIN_VALUE)
public String getVehicleDetailsText(@PathVariable String username) {
VehicleDetails details = this.userVehicleService.getVehicleDetails(username);
return details.getMake() + " " + details.getModel();
}
@GetMapping(path = "/{username}/vehicle", produces = MediaType.APPLICATION_JSON_VALUE)
public VehicleDetails VehicleDetailsJson(@PathVariable String username) {
return this.userVehicleService.getVehicleDetails(username);
}
@GetMapping(path = "/{username}/vehicle.html", produces = MediaType.TEXT_HTML_VALUE)
public String VehicleDetailsHtml(@PathVariable String username) {
VehicleDetails details = this.userVehicleService.getVehicleDetails(username);
String makeAndModel = details.getMake() + " " + details.getModel();
return "<html><body><h1>" + makeAndModel + "</h1></body></html>";
}
@ExceptionHandler
@ResponseStatus(HttpStatus.NOT_FOUND)
private void handleVinNotFound(VehicleIdentificationNumberNotFoundException ex) {
}
}
Metadata
Metadata
Assignees
Labels
No labels