From d5630da5e1ecb7b0f13667890d6ff78a175966c2 Mon Sep 17 00:00:00 2001 From: YOON Date: Fri, 12 Jan 2024 12:20:42 +0900 Subject: [PATCH] =?UTF-8?q?[Style]=20=EC=BD=94=EB=93=9C=EC=BB=A8=EB=B2=A4?= =?UTF-8?q?=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/com/mjucow/eatda/common/vo/Latitude.kt | 4 ++-- src/main/kotlin/com/mjucow/eatda/common/vo/Longitude.kt | 7 ++----- src/test/kotlin/com/mjucow/eatda/common/vo/LatitudeTest.kt | 2 +- .../kotlin/com/mjucow/eatda/common/vo/LongitudeTest.kt | 1 - 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/com/mjucow/eatda/common/vo/Latitude.kt b/src/main/kotlin/com/mjucow/eatda/common/vo/Latitude.kt index 59b6148..bdfa353 100644 --- a/src/main/kotlin/com/mjucow/eatda/common/vo/Latitude.kt +++ b/src/main/kotlin/com/mjucow/eatda/common/vo/Latitude.kt @@ -8,12 +8,12 @@ value class Latitude( val value: Double, ) { init { - if (LATITUDE_MIN > value || LATITUDE_MAX < value) { + if (LATITUDE_MIN > value || LATITUDE_MAX < value) { throw IllegalArgumentException() } } - companion object{ + companion object { private const val LATITUDE_MIN = -90.0 private const val LATITUDE_MAX = 90.0 } diff --git a/src/main/kotlin/com/mjucow/eatda/common/vo/Longitude.kt b/src/main/kotlin/com/mjucow/eatda/common/vo/Longitude.kt index 97105ed..d3691bf 100644 --- a/src/main/kotlin/com/mjucow/eatda/common/vo/Longitude.kt +++ b/src/main/kotlin/com/mjucow/eatda/common/vo/Longitude.kt @@ -7,16 +7,13 @@ value class Longitude( @JsonProperty(value = "longitude") val value: Double, ) { - init { - if ( LONGITUDE_MIN > value || LONGITUDE_MAX < value) { + if (LONGITUDE_MIN > value || LONGITUDE_MAX < value) { throw IllegalArgumentException() } } - - companion object{ + companion object { private const val LONGITUDE_MIN = 0.0 private const val LONGITUDE_MAX = 180.0 - } } diff --git a/src/test/kotlin/com/mjucow/eatda/common/vo/LatitudeTest.kt b/src/test/kotlin/com/mjucow/eatda/common/vo/LatitudeTest.kt index 53fbc2a..19ed691 100644 --- a/src/test/kotlin/com/mjucow/eatda/common/vo/LatitudeTest.kt +++ b/src/test/kotlin/com/mjucow/eatda/common/vo/LatitudeTest.kt @@ -23,7 +23,7 @@ class LatitudeTest : VOTest { @DisplayName("위도의 범위가 올바르면 객체가 생성된다.") @ParameterizedTest - @ValueSource(doubles = [-Double.MAX_VALUE,-91.0, 91.0,Double.MAX_VALUE]) + @ValueSource(doubles = [-Double.MAX_VALUE, -91.0, 91.0, Double.MAX_VALUE]) fun throwExceptionWhenInvalidNumber(value: Double) { // given diff --git a/src/test/kotlin/com/mjucow/eatda/common/vo/LongitudeTest.kt b/src/test/kotlin/com/mjucow/eatda/common/vo/LongitudeTest.kt index 7c7a513..db5b12e 100644 --- a/src/test/kotlin/com/mjucow/eatda/common/vo/LongitudeTest.kt +++ b/src/test/kotlin/com/mjucow/eatda/common/vo/LongitudeTest.kt @@ -45,5 +45,4 @@ class LongitudeTest : VOTest { // then assertThat(isEqaulsAndSameHashcode).isTrue() } - }