@Test
    void testInitCreationForm() throws Exception {
        mockMvc.perform(get("/owners/{ownerId}/pets/new", TEST_OWNER_ID))
            .andExpect(status().isOk())
            .andExpect(view().name("pets/createOrUpdatePetForm"))
            .andExpect(model().attributeExists("pet"));
    }
Test class for the {@link PetController}

@author Colin But
src/test/java/org/springframework/samples/petclinic/web/PetControllerTests.java