From fd74324cac532d5d05f243025fe1e9d73df511ba Mon Sep 17 00:00:00 2001 From: Nicolas N Date: Fri, 1 Dec 2023 22:02:06 +0100 Subject: [PATCH] Ny versjon libs common (OMS) (#128) --- .../src/test/kotlin/NotifikasjonTest.kt | 40 +++++++++++++++++++ .../src/test/kotlin/SendNotifikasjonTest.kt | 17 ++++++++ buildSrc/src/main/kotlin/Constants.kt | 10 +---- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/apps/etterlatte-notifikasjoner/src/test/kotlin/NotifikasjonTest.kt b/apps/etterlatte-notifikasjoner/src/test/kotlin/NotifikasjonTest.kt index 9f6bb0675..5858664ee 100644 --- a/apps/etterlatte-notifikasjoner/src/test/kotlin/NotifikasjonTest.kt +++ b/apps/etterlatte-notifikasjoner/src/test/kotlin/NotifikasjonTest.kt @@ -124,6 +124,46 @@ internal class NotifikasjonTest { ) } + @Test + fun `Skal opprette notifikasjon til innsender ved innsending av omstillingsstoenad`() { + val omstillingsstoenadSoeknad = InnsendtSoeknadFixtures.omstillingsSoeknad() + val soeknad: String = mapper.writeValueAsString(omstillingsstoenadSoeknad) + val inspector = TestRapid() + .apply { + Notifikasjon( + sendMelding, + this + ) + } + .apply { + sendTestMessage( + JsonMessage.newMessage( + mapOf( + "@event_name" to "soeknad_innsendt", + "@dokarkivRetur" to "123456", + "@fnr_soeker" to "07106123912", + "@skjema_info" to mapper.readTree(soeknad), + "@lagret_soeknad_id" to "4", + "@dokarkivRetur" to (mapOf("journalpostId" to "5")) + ) + ) + .toJson() + ) + }.inspektør + + assertEquals("notifikasjon_sendt", inspector.message(0).get("@event_name").asText()) + assertEquals("Notifikasjon sendt", inspector.message(0).get("@notifikasjon").asText()) + assertEquals("5", inspector.message(0).get("@journalpostId").asText()) + assertEquals("4", inspector.message(0).get("@lagret_soeknad_id").asText()) + assertEquals("SendNotifikasjon 5", inspector.key(0)) + assertEquals(mockKafkaProducer.history().size, 1) + assertEquals(mockKafkaProducer.history()[0].value().getTekst(), "Vi har mottatt søknaden din om omstillingsstønad") + assertEquals( + omstillingsstoenadSoeknad.innsender.foedselsnummer.svar.value, + mockKafkaProducer.history()[0].key().getFodselsnummer() + ) + } + @AfterAll fun tearDown() { kafkaContainer.stop() diff --git a/apps/etterlatte-notifikasjoner/src/test/kotlin/SendNotifikasjonTest.kt b/apps/etterlatte-notifikasjoner/src/test/kotlin/SendNotifikasjonTest.kt index 35d541fa5..e91fd2ccc 100644 --- a/apps/etterlatte-notifikasjoner/src/test/kotlin/SendNotifikasjonTest.kt +++ b/apps/etterlatte-notifikasjoner/src/test/kotlin/SendNotifikasjonTest.kt @@ -51,6 +51,23 @@ class SendNotifikasjonTest { assertEquals(4, beskjed.getSikkerhetsnivaa()) assertEquals(false, beskjed.getEksternVarsling()) } + + @Test + fun `skal opprette melding for omstillingsstoenad`() { + val beskjed = sendNotifikasjon.opprettBeskjed(InnsendtSoeknadFixtures.omstillingsSoeknad()) + assertEquals(false, beskjed.getEksternVarsling()) + assertEquals("Vi har mottatt søknaden din om omstillingsstønad", beskjed.getTekst()) + assertEquals(true, isWithin10Seconds(beskjed.getTidspunkt().toLocalDateTime())) + assertEquals( + true, + isWithin10Seconds( + beskjed.getSynligFremTil().toLocalDateTime(), + LocalDateTime.now(ZoneOffset.UTC).plusDays(7) + ) + ) + assertEquals(4, beskjed.getSikkerhetsnivaa()) + assertEquals(false, beskjed.getEksternVarsling()) + } } fun isWithin10Seconds(actual: LocalDateTime, expected: LocalDateTime = LocalDateTime.now(ZoneOffset.UTC)): Boolean = diff --git a/buildSrc/src/main/kotlin/Constants.kt b/buildSrc/src/main/kotlin/Constants.kt index a1b1b1507..f433d3344 100644 --- a/buildSrc/src/main/kotlin/Constants.kt +++ b/buildSrc/src/main/kotlin/Constants.kt @@ -8,8 +8,8 @@ object NavFelles { } object Etterlatte { - const val Common = "no.nav.etterlatte:common:2023.03.28-16.21.c37f68b0da69" - const val CommonTest = "no.nav.etterlatte:common-test:2023.03.28-13.28.4f49c60d85e4" + const val Common = "no.nav.etterlatte:common:2023.12.01-19.28.04ed855ae6eb" + const val CommonTest = "no.nav.etterlatte:common-test:2023.12.01-19.28.04ed855ae6eb" const val KtorClientAuth = "no.nav.etterlatte:ktor-client-auth:2022.09.28-10.09.cce630926582" } @@ -72,9 +72,3 @@ object Cxf { const val CxfTransportsHttp = "org.apache.cxf:cxf-rt-transports-http:$version" const val CxfWsSecurity = "org.apache.cxf:cxf-rt-ws-security:$version" } - -object Kotest { - private const val version = "5.4.2" - - const val AssertionsCore = "io.kotest:kotest-assertions-core:$version" -}