-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NAV-22995: Endrer fra Clock til ClockProvider for å sikre at sommerti…
…d/vintertid fungerer korrekt (#4876) Favro: [NAV-22995](https://favro.com/organization/98c34fb974ce445eac854de0/1844bbac3b6605eacc8f5543?card=NAV-22995) ### 💰 Hva skal gjøres, og hvorfor? ClockProvider oppretter en ny instanse av Clock hver gang det kalles. Dette sikrer at sommertid/vintertid vil fungere. ### 🔎️ Er det noe spesielt du ønsker tilbakemelding om? Nei ### ✅ Checklist _Har du husket alle punktene i listen?_ - [ ] Jeg har testet mine endringer i henhold til akseptansekriteriene 🕵️ - [ ] Jeg har config- eller sql-endringer. I så fall, husk manuell deploy til miljø for å verifisere endringene. - [x] Jeg har skrevet tester. Hvis du ikke har skrevet tester, beskriv hvorfor under 👇 ### 💬 Ønsker du en muntlig gjennomgang? - [ ] Ja - [x] Nei
- Loading branch information
Showing
4 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/no/nav/familie/ba/sak/common/ClockProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package no.nav.familie.ba.sak.common | ||
|
||
import java.time.Clock | ||
|
||
fun interface ClockProvider { | ||
fun get(): Clock | ||
} |
8 changes: 6 additions & 2 deletions
8
.../nav/familie/ba/sak/config/ClockConfig.kt → ...ilie/ba/sak/config/ClockProviderConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
package no.nav.familie.ba.sak.config | ||
|
||
import no.nav.familie.ba.sak.common.ClockProvider | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import java.time.Clock | ||
|
||
@Configuration | ||
class ClockConfig { | ||
class ClockProviderConfig { | ||
@Bean | ||
fun clock(): Clock = Clock.systemDefaultZone() | ||
fun clockProvider(): ClockProvider = | ||
ClockProvider { | ||
Clock.systemDefaultZone() | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/test/enhetstester/kotlin/no/nav/familie/ba/sak/common/TestClockProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package no.nav.familie.ba.sak | ||
|
||
import no.nav.familie.ba.sak.common.ClockProvider | ||
import java.time.Clock | ||
|
||
class TestClockProvider( | ||
private val clock: Clock, | ||
) : ClockProvider { | ||
override fun get(): Clock = clock | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters