Card 05/ 06
All 6 cards
ExerciseDifficulty: Advanced1 min
Add a Constraint
RideRequest needs a third field, vehicleType, that must be one of "sedan", "suv" or "van". Which annotation constrains a String to match a pattern, and what would the pattern look like?
See the answer
@Pattern(regexp = "^(sedan|suv|van)$", message = "Invalid vehicle type")
String vehicleType