mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 13:25:49 +00:00
Updating using GitHub API 2025-06-19-15:31
This commit is contained in:
parent
c0c2985bd5
commit
f75823ddc2
1 changed files with 6 additions and 6 deletions
|
@ -10,7 +10,7 @@
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ import java.util.Optional;
|
||||||
class VisitControllerTests {
|
class VisitControllerTests {
|
||||||
|
|
||||||
private static final int TEST_OWNER_ID = 1;
|
private static final int TEST_OWNER_ID = 1;
|
||||||
|
|
||||||
private static final int TEST_PET_ID = 1;
|
private static final int TEST_PET_ID = 1;
|
||||||
|
private static final String NEW_VISIT_URL = "/owners/{ownerId}/pets/{petId}/visits/new";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MockMvc mockMvc;
|
private MockMvc mockMvc;
|
||||||
|
@ -66,7 +66,7 @@ class VisitControllerTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testInitNewVisitForm() throws Exception {
|
void testInitNewVisitForm() throws Exception {
|
||||||
mockMvc.perform(get("/owners/{ownerId}/pets/{petId}/visits/new", TEST_OWNER_ID, TEST_PET_ID))
|
mockMvc.perform(get(NEW_VISIT_URL, TEST_OWNER_ID, TEST_PET_ID))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(view().name("pets/createOrUpdateVisitForm"));
|
.andExpect(view().name("pets/createOrUpdateVisitForm"));
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ class VisitControllerTests {
|
||||||
@Test
|
@Test
|
||||||
void testProcessNewVisitFormSuccess() throws Exception {
|
void testProcessNewVisitFormSuccess() throws Exception {
|
||||||
mockMvc
|
mockMvc
|
||||||
.perform(post("/owners/{ownerId}/pets/{petId}/visits/new", TEST_OWNER_ID, TEST_PET_ID)
|
.perform(post(NEW_VISIT_URL, TEST_OWNER_ID, TEST_PET_ID)
|
||||||
.param("name", "George")
|
.param("name", "George")
|
||||||
.param("description", "Visit Description"))
|
.param("description", "Visit Description"))
|
||||||
.andExpect(status().is3xxRedirection())
|
.andExpect(status().is3xxRedirection())
|
||||||
|
@ -84,11 +84,11 @@ class VisitControllerTests {
|
||||||
@Test
|
@Test
|
||||||
void testProcessNewVisitFormHasErrors() throws Exception {
|
void testProcessNewVisitFormHasErrors() throws Exception {
|
||||||
mockMvc
|
mockMvc
|
||||||
.perform(post("/owners/{ownerId}/pets/{petId}/visits/new", TEST_OWNER_ID, TEST_PET_ID).param("name",
|
.perform(post(NEW_VISIT_URL, TEST_OWNER_ID, TEST_PET_ID).param("name",
|
||||||
"George"))
|
"George"))
|
||||||
.andExpect(model().attributeHasErrors("visit"))
|
.andExpect(model().attributeHasErrors("visit"))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(view().name("pets/createOrUpdateVisitForm"));
|
.andExpect(view().name("pets/createOrUpdateVisitForm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue