Skip to content

Commit

Permalink
Feature: (BRD-73) 시간대 규칙 TimeRule.ZONE_ID 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ttasjwi committed Nov 15, 2024
1 parent 6f5470e commit aadba54
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ttasjwi.board.system.core.time

import java.time.ZoneId

object TimeRule {
val ZONE_ID: ZoneId = ZoneId.of("Asia/Seoul")
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package com.ttasjwi.board.system.core.time.impl

import com.ttasjwi.board.system.core.annotation.component.AppComponent
import com.ttasjwi.board.system.core.time.TimeManager
import com.ttasjwi.board.system.core.time.TimeRule
import java.time.ZonedDateTime

@AppComponent
class TimeManagerImpl : TimeManager {

override fun now(): ZonedDateTime {
return ZonedDateTime.now()
return ZonedDateTime.now(TimeRule.ZONE_ID)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.ttasjwi.board.system.core.time

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import java.time.ZoneId

@DisplayName("TimeRule: 우리 서비스의 시간대 규칙")
class TimeRuleTest {

@Test
@DisplayName("우리 서비스의 기준 시간대는 서울 시간을 기준으로 삼는다.")
fun testZoneId() {
assertThat(TimeRule.ZONE_ID).isEqualTo(ZoneId.of("Asia/Seoul"))
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ttasjwi.board.system.core.time.fixture

import com.ttasjwi.board.system.core.time.TimeRule
import java.time.ZoneId
import java.time.ZonedDateTime

Expand All @@ -11,7 +12,7 @@ fun timeFixture(
minute: Int = 0,
second: Int = 0,
nanoOfSecond: Int = 0,
zone: ZoneId = ZoneId.of("Asia/Seoul")
zone: ZoneId = TimeRule.ZONE_ID
): ZonedDateTime {
return ZonedDateTime.of(
year,
Expand Down

0 comments on commit aadba54

Please sign in to comment.