From ec00e445a07d6d52a935581869ea9e936fced76e Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Thu, 8 Sep 2022 09:47:19 +0200 Subject: [PATCH] improve code + mutation coverage in HsAdminPersonEntity --- .../person/HsAdminPersonEntityUnitTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/test/java/net/hostsharing/hsadminng/hs/admin/person/HsAdminPersonEntityUnitTest.java diff --git a/src/test/java/net/hostsharing/hsadminng/hs/admin/person/HsAdminPersonEntityUnitTest.java b/src/test/java/net/hostsharing/hsadminng/hs/admin/person/HsAdminPersonEntityUnitTest.java new file mode 100644 index 00000000..ea2b00ad --- /dev/null +++ b/src/test/java/net/hostsharing/hsadminng/hs/admin/person/HsAdminPersonEntityUnitTest.java @@ -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"); + } + +}