mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-12-27 19:07:28 +00:00
Test: Add null name case to PetTypeFormatterTests
Adds a unit test to verify that PetTypeFormatter returns '<null>' when the PetType name is null, ensuring better coverage and robustness. Signed-off-by: ronanpjr <ronanpjr@proton.me>
This commit is contained in:
parent
3e1ce239f4
commit
670e0a2bbe
1 changed files with 8 additions and 1 deletions
|
|
@ -5,7 +5,7 @@
|
|||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
|
@ -60,6 +60,13 @@ class PetTypeFormatterTests {
|
|||
assertThat(petTypeName).isEqualTo("Hamster");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPrintWithNullName() {
|
||||
PetType petType = new PetType();
|
||||
String petTypeName = this.petTypeFormatter.print(petType, Locale.ENGLISH);
|
||||
assertThat(petTypeName).isEqualTo("<null>");
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldParse() throws ParseException {
|
||||
given(types.findPetTypes()).willReturn(makePetTypes());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue