From 86bab024a1d95e8809f3c2d13f3e1251db783cbd Mon Sep 17 00:00:00 2001 From: Jan Kroken Date: Thu, 24 Oct 2024 20:58:14 +0200 Subject: [PATCH] fikset en test --- .../BarnetrygdinformasjonRepositoryTest.kt | 2 +- .../external/pdl/WiremockScenario.kt | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/test/kotlin/no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/barnetrygd/repository/BarnetrygdinformasjonRepositoryTest.kt b/src/test/kotlin/no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/barnetrygd/repository/BarnetrygdinformasjonRepositoryTest.kt index f54a513..b806816 100644 --- a/src/test/kotlin/no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/barnetrygd/repository/BarnetrygdinformasjonRepositoryTest.kt +++ b/src/test/kotlin/no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/barnetrygd/repository/BarnetrygdinformasjonRepositoryTest.kt @@ -69,7 +69,7 @@ class BarnetrygdinformasjonRepositoryTest( barnetrygdinformasjonRepository.frigi(locked1) val locked3 = barnetrygdinformasjonRepository.finnNesteTilBehandling(3) assertThat(locked3.data).hasSize(3) - assertThat(locked3.data).containsExactlyElementsOf(locked1.data) + assertThat(locked3.data).containsExactlyInAnyOrderElementsOf(locked1.data) } diff --git a/src/test/kotlin/no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/external/pdl/WiremockScenario.kt b/src/test/kotlin/no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/external/pdl/WiremockScenario.kt index 1635360..7a7e979 100644 --- a/src/test/kotlin/no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/external/pdl/WiremockScenario.kt +++ b/src/test/kotlin/no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/external/pdl/WiremockScenario.kt @@ -20,6 +20,22 @@ private fun WireMockExtension.pdlResponse(fileName: String): StubMapping { } } +private fun WireMockExtension.pdlResponse(fnr: String, fileName: String): StubMapping { + synchronized(this) { + return this.stubFor( + WireMock.post(WireMock.urlPathEqualTo("/graphql")) + .withRequestBody(WireMock.containing(""""variables":{"ident":"$fnr"}""")) + .willReturn( + aResponse() + .withHeader("Content-Type", "application/json") + .withStatus(202) + .withBodyFile("pdl/$fileName") + ) + ) + } +} + + fun WireMockExtension.`pdl med ett fnr`(fnr: String): StubMapping { synchronized(this) { return this.stubFor( @@ -85,6 +101,10 @@ fun WireMockExtension.`pdl error not_found`(): StubMapping { return this.pdlResponse("error_not_found.json") } +fun WireMockExtension.`pdl error not_found`(fnr: String): StubMapping { + return this.pdlResponse(fnr, "error_not_found.json") +} + fun WireMockExtension.`pdl server error`(): StubMapping { return this.pdlResponse("error_server_error.json") }