spring-petclinic icon indicating copy to clipboard operation
spring-petclinic copied to clipboard

Add user friendly validation messages

Open lukasdo opened this issue 1 year ago • 0 comments

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.

lukasdo avatar Feb 05 '24 15:02 lukasdo