mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:25:50 +00:00
Update PetControllerTests.java
correct testProcessCreationFormHasErrors method's post url
This commit is contained in:
parent
23f65ba7d0
commit
e20b43b009
1 changed files with 3 additions and 1 deletions
|
@ -83,12 +83,14 @@ public class PetControllerTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProcessCreationFormHasErrors() throws Exception {
|
public void testProcessCreationFormHasErrors() throws Exception {
|
||||||
mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID)
|
mockMvc.perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID)
|
||||||
.param("name", "Betty")
|
.param("name", "Betty")
|
||||||
.param("birthDate", "2015-02-12")
|
.param("birthDate", "2015-02-12")
|
||||||
)
|
)
|
||||||
.andExpect(model().attributeHasNoErrors("owner"))
|
.andExpect(model().attributeHasNoErrors("owner"))
|
||||||
.andExpect(model().attributeHasErrors("pet"))
|
.andExpect(model().attributeHasErrors("pet"))
|
||||||
|
.andExpect(model().attributeHasFieldErrors("pet", "type"))
|
||||||
|
.andExpect(model().attributeHasFieldErrorCode("pet", "type", "required"))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(view().name("pets/createOrUpdatePetForm"));
|
.andExpect(view().name("pets/createOrUpdatePetForm"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue