From fda20cae73ec10a8971b40d56fe6fd9f8b04d7a5 Mon Sep 17 00:00:00 2001 From: shindong96 <2006peter@naver.com> Date: Wed, 9 Oct 2024 20:01:23 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20null=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/gohigher/common/EmploymentType.java | 2 +- .../src/test/java/gohigher/common/EmploymentTypeTest.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core-domain/src/main/java/gohigher/common/EmploymentType.java b/core-domain/src/main/java/gohigher/common/EmploymentType.java index 61c3f0a7..8eb7595b 100644 --- a/core-domain/src/main/java/gohigher/common/EmploymentType.java +++ b/core-domain/src/main/java/gohigher/common/EmploymentType.java @@ -15,7 +15,7 @@ public enum EmploymentType { ; public static EmploymentType from(String value) { - if (value.isBlank()) { + if (value == null || value.isBlank()) { return UNDEFINED; } diff --git a/core-domain/src/test/java/gohigher/common/EmploymentTypeTest.java b/core-domain/src/test/java/gohigher/common/EmploymentTypeTest.java index dac1bd11..a9ab319f 100644 --- a/core-domain/src/test/java/gohigher/common/EmploymentTypeTest.java +++ b/core-domain/src/test/java/gohigher/common/EmploymentTypeTest.java @@ -16,4 +16,11 @@ void getValue_if_UNDEFINED() { // when & then assertThat(employmentType.getValue()).isNull(); } + + @DisplayName("null이 들어오는경우 UNDEFINED 반환") + @Test + void makeEmploymentByNull() { + // given & when & then + assertThat(EmploymentType.from(null)).isEqualTo(EmploymentType.UNDEFINED); + } }