spring-petclinic
spring-petclinic copied to clipboard
Add user friendly validation messages
As described in #1351 the validation messages are not very user-friendly. Additionally the validation of the telephone number (which is a String value) with @Digits
is faulty because leading zeros are ignored when converting from String to BigDecimal in the DigitsValidator. This faulty behaviour was also visible in the tests where an 11 digit number was parsed as the telephone number.
@Test
void testProcessCreationFormSuccess() throws Exception {
mockMvc
.perform(post("/owners/new").param("firstName", "Joe")
.param("lastName", "Bloggs")
.param("address", "123 Caramel Street")
.param("city", "London")
.param("telephone", "01316761638"))
.andExpect(status().is3xxRedirection());
}
These caused the failing tests in #1361.