mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 14:55:50 +00:00
Add unit test for processUpdateOwnerForm in OwnerController with validation errors
This commit is contained in:
parent
4b035d68ff
commit
7d966a0d68
1 changed files with 14 additions and 0 deletions
|
@ -53,4 +53,18 @@ class OwnerControllerTest {
|
||||||
verifyNoInteractions(ownerRepository);
|
verifyNoInteractions(ownerRepository);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test processUpdateOwnerForm with validation errors")
|
||||||
|
void testProcessUpdateOwnerFormWithValidationErrors() {
|
||||||
|
Owner owner = new Owner();
|
||||||
|
|
||||||
|
doReturn(true).when(result).hasErrors();
|
||||||
|
|
||||||
|
String view = ownerController.processUpdateOwnerForm(owner, result, 1, redirectAttributes);
|
||||||
|
|
||||||
|
assertThat(view).isEqualTo("owners/createOrUpdateOwnerForm");
|
||||||
|
verify(result).hasErrors();
|
||||||
|
verifyNoInteractions(ownerRepository);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue