improve test coverage

This commit is contained in:
Michael Hoennig 2024-01-24 15:56:34 +01:00
parent 4ca89df6fd
commit d34e1f9e14

View File

@ -1,5 +1,6 @@
package net.hostsharing.hsadminng.hs.office.person; package net.hostsharing.hsadminng.hs.office.person;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.EnumSource;
@ -15,10 +16,19 @@ class HsOfficePersonTypeConverterUnitTest {
assertThat(converter.convertToDatabaseColumn(given)).isEqualTo(given.shortName); assertThat(converter.convertToDatabaseColumn(given)).isEqualTo(given.shortName);
} }
@Test
void mapsNullToDatabaseValue() {
assertThat(converter.convertToDatabaseColumn(null)).isEqualTo(null);
}
@ParameterizedTest @ParameterizedTest
@EnumSource(HsOfficePersonType.class) @EnumSource(HsOfficePersonType.class)
void mapsFromDatabaseValue(final HsOfficePersonType given) { void mapsFromDatabaseValue(final HsOfficePersonType given) {
assertThat(converter.convertToEntityAttribute(given.shortName)).isEqualTo(given); assertThat(converter.convertToEntityAttribute(given.shortName)).isEqualTo(given);
} }
@Test
void mapsNullFromDatabaseValue() {
assertThat(converter.convertToEntityAttribute(null)).isEqualTo(null);
}
} }