Add unit test for findPet method in PetController to handle null petId scenario

This commit is contained in:
Auto_EPMD-EDP AIAssistant 2024-10-25 11:47:02 +03:00
parent 605eedff8e
commit 02a406bbad

View file

@ -67,4 +67,12 @@ class PetControllerTest {
verify(ownerRepository).findById(ownerId); 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();
}
} }