mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-16 12:45:48 +00:00
Add test case for invalid phone number format in owner creation form
This commit is contained in:
parent
cefaf55dd1
commit
4c42a20b37
1 changed files with 14 additions and 0 deletions
|
@ -248,4 +248,18 @@ class OwnerControllerTests {
|
|||
.andExpect(flash().attributeExists("error"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessCreationFormWithInvalidPhoneNumber() throws Exception {
|
||||
mockMvc
|
||||
.perform(post("/owners/new").param("firstName", "Anna")
|
||||
.param("lastName", "Smith")
|
||||
.param("address", "321 Baker Street")
|
||||
.param("city", "Springfield")
|
||||
.param("telephone", "abc1234567"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(model().attributeHasErrors("owner"))
|
||||
.andExpect(model().attributeHasFieldErrors("owner", "telephone"))
|
||||
.andExpect(view().name("owners/createOrUpdateOwnerForm"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue