improve code + mutation coverage in HsAdminPersonEntity

This commit is contained in:
Michael Hoennig 2022-09-08 09:47:19 +02:00
parent 37e7b5179d
commit ec00e445a0
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
package net.hostsharing.hsadminng.hs.admin.person;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class HsAdminPersonEntityUnitTest {
@Test
void getDisplayReturnsTradeNameIfAvailable() {
final var givenPersonEntity = HsAdminPersonEntity.builder()
.tradeName("some trade name")
.build();
final var actualDisplay = givenPersonEntity.getDisplayName();
assertThat(actualDisplay).isEqualTo("some trade name");
}
@Test
void getDisplayReturnsFamilyAndGivenNameIfNoTradeNameAvailable() {
final var givenPersonEntity = HsAdminPersonEntity.builder()
.familyName("some family name")
.givenName("some given name")
.build();
final var actualDisplay = givenPersonEntity.getDisplayName();
assertThat(actualDisplay).isEqualTo("some family name, some given name");
}
}