mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 06:45:50 +00:00
Add unit test for findPet method in PetController to handle null petId scenario
This commit is contained in:
parent
605eedff8e
commit
02a406bbad
1 changed files with 8 additions and 0 deletions
|
@ -67,4 +67,12 @@ class PetControllerTest {
|
|||
verify(ownerRepository).findById(ownerId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Test findPet with null petId returns new Pet")
|
||||
void testFindPetWithNullPetIdReturnsNewPet() {
|
||||
int ownerId = 1;
|
||||
Pet pet = petController.findPet(ownerId, null);
|
||||
assertThat(pet).isNotNull();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue