From 69def70229ae1987047a3753c5c8debd949d0984 Mon Sep 17 00:00:00 2001 From: Cato Olsen Date: Thu, 9 Jan 2025 12:23:10 +0100 Subject: [PATCH] - Removed boilerplate JwtDecoder mocks. - Added missing test profile config placeholders. - Removed a few Sonar warnings. --- .../ApplicationContextTest.java | 10 +-- .../src/test/resources/application-test.yml | 3 +- .../ApplicationContextTest.java | 10 ++- .../src/test/resources/application-test.yml | 1 + .../ApplicationContextTest.java | 12 ++-- .../src/test/resources/application-test.yml | 1 + .../ApplicationContextTest.java | 10 ++- .../src/test/resources/application-test.yml | 1 + .../ApplicationContextTest.java | 12 ++-- .../src/test/resources/application-test.yml | 1 + .../ApplicationContextTest.java | 10 +-- .../src/test/resources/application-test.yml | 1 + ...eidsforholdAnsettelseApplicationTests.java | 9 +-- .../src/test/resources/application-test.yml | 1 + .../src/test/resources/application-test.yml | 1 + .../ApplicationContextTest.java | 12 ++-- .../src/test/resources/application-test.yml | 1 + .../ApplicationContextTest.java | 8 --- .../src/test/resources/application-test.yml | 1 + .../ApplicationContextTest.java | 10 ++- .../src/test/resources/application-test.yml | 1 + .../profil/ApplicationContextTest.java | 10 ++- .../consumer/ArbeidsforholdConsumerTest.java | 25 +++----- .../consumer/HelsepersonellConsumerTest.java | 17 ++--- .../consumer/OrganisasjonConsumerTest.java | 21 +++---- .../consumer/PdlProxyConsumerTest.java | 23 +++---- .../consumer/SykemeldingConsumerTest.java | 62 ++++++------------- .../consumer/SyntElsamConsumerTest.java | 23 +++---- ...tSykemeldingControllerIntegrationTest.java | 5 -- .../src/test/resources/application-test.yml | 1 + .../identpool/ComponentTestConfig.java | 6 +- .../src/test/resources/application-test.yml | 2 +- .../ApplicationContextTest.java | 6 -- .../udistub/converter/itest/UdiStubITest.java | 5 +- .../src/test/resources/application-test.yml | 1 + 35 files changed, 115 insertions(+), 208 deletions(-) diff --git a/apps/altinn3-tilgang-service/src/test/java/no/nav/testnav/altinn3tilgangservice/ApplicationContextTest.java b/apps/altinn3-tilgang-service/src/test/java/no/nav/testnav/altinn3tilgangservice/ApplicationContextTest.java index 3fed84b2557..699fd8581f4 100644 --- a/apps/altinn3-tilgang-service/src/test/java/no/nav/testnav/altinn3tilgangservice/ApplicationContextTest.java +++ b/apps/altinn3-tilgang-service/src/test/java/no/nav/testnav/altinn3tilgangservice/ApplicationContextTest.java @@ -4,21 +4,21 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; import org.springframework.test.context.ActiveProfiles; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + @SpringBootTest @ActiveProfiles("test") class ApplicationContextTest { @MockBean - public ReactiveJwtDecoder jwtDecoder; - - @MockBean + @SuppressWarnings("unused") public SecretManagerServiceClient secretManagerClient; @Test - @SuppressWarnings("java:S2699") void load_app_context() { + assertThat(true).isTrue(); } + } diff --git a/apps/altinn3-tilgang-service/src/test/resources/application-test.yml b/apps/altinn3-tilgang-service/src/test/resources/application-test.yml index dfbee67495e..58d0dd3fd6a 100644 --- a/apps/altinn3-tilgang-service/src/test/resources/application-test.yml +++ b/apps/altinn3-tilgang-service/src/test/resources/application-test.yml @@ -1,5 +1,6 @@ -ALTINN_URL: http://localhost:8080 ALTINN_API_KEY: dummy +ALTINN_URL: http://localhost:8080 +AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder MASKINPORTEN_CLIENT_ID: dummy MASKINPORTEN_CLIENT_JWK: dummy MASKINPORTEN_SCOPES: dummy diff --git a/apps/app-tilgang-analyse-service/src/test/java/no/nav/testnav/apps/apptilganganalyseservice/ApplicationContextTest.java b/apps/app-tilgang-analyse-service/src/test/java/no/nav/testnav/apps/apptilganganalyseservice/ApplicationContextTest.java index 5c21de929dd..d36088e8995 100644 --- a/apps/app-tilgang-analyse-service/src/test/java/no/nav/testnav/apps/apptilganganalyseservice/ApplicationContextTest.java +++ b/apps/app-tilgang-analyse-service/src/test/java/no/nav/testnav/apps/apptilganganalyseservice/ApplicationContextTest.java @@ -2,19 +2,17 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + @SpringBootTest @ActiveProfiles("test") class ApplicationContextTest { - @MockBean - public JwtDecoder jwtDecoder; - @Test - @SuppressWarnings("java:S2699") void load_app_context() { + assertThat(true).isTrue(); } + } diff --git a/apps/app-tilgang-analyse-service/src/test/resources/application-test.yml b/apps/app-tilgang-analyse-service/src/test/resources/application-test.yml index 77a88244e60..b5cec49b00a 100644 --- a/apps/app-tilgang-analyse-service/src/test/resources/application-test.yml +++ b/apps/app-tilgang-analyse-service/src/test/resources/application-test.yml @@ -1,3 +1,4 @@ +AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder DOLLY_READER_TOKEN: test TOKEN_X_ISSUER: dummy diff --git a/apps/batch-bestilling-service/src/test/java/no/nav/registre/testnorge/batchbestillingservice/ApplicationContextTest.java b/apps/batch-bestilling-service/src/test/java/no/nav/registre/testnorge/batchbestillingservice/ApplicationContextTest.java index 5d5cc248a00..ffcbb8894b2 100644 --- a/apps/batch-bestilling-service/src/test/java/no/nav/registre/testnorge/batchbestillingservice/ApplicationContextTest.java +++ b/apps/batch-bestilling-service/src/test/java/no/nav/registre/testnorge/batchbestillingservice/ApplicationContextTest.java @@ -2,19 +2,17 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + @ActiveProfiles("test") @SpringBootTest -public class ApplicationContextTest { - - @MockBean - public JwtDecoder jwtDecoder; +class ApplicationContextTest { @Test - @SuppressWarnings("java:S2699") void load_app_context() { + assertThat(true).isTrue(); } + } diff --git a/apps/batch-bestilling-service/src/test/resources/application-test.yml b/apps/batch-bestilling-service/src/test/resources/application-test.yml index 198e40dc002..7af80f7078f 100644 --- a/apps/batch-bestilling-service/src/test/resources/application-test.yml +++ b/apps/batch-bestilling-service/src/test/resources/application-test.yml @@ -1,4 +1,5 @@ AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder +AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder TOKEN_X_ISSUER: dummy spring: diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/test/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/ApplicationContextTest.java b/apps/generer-arbeidsforhold-populasjon-service/src/test/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/ApplicationContextTest.java index 8f02c58e9b9..a2392ea6603 100644 --- a/apps/generer-arbeidsforhold-populasjon-service/src/test/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/ApplicationContextTest.java +++ b/apps/generer-arbeidsforhold-populasjon-service/src/test/java/no/nav/registre/testnav/genererarbeidsforholdpopulasjonservice/ApplicationContextTest.java @@ -3,20 +3,18 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + @SpringBootTest @ActiveProfiles("test") class ApplicationContextTest { - @MockBean - public JwtDecoder jwtDecoder; - @Test - @SuppressWarnings("java:S2699") void load_app_context() { + assertThat(true).isTrue(); } + } diff --git a/apps/generer-arbeidsforhold-populasjon-service/src/test/resources/application-test.yml b/apps/generer-arbeidsforhold-populasjon-service/src/test/resources/application-test.yml index 198e40dc002..7af80f7078f 100644 --- a/apps/generer-arbeidsforhold-populasjon-service/src/test/resources/application-test.yml +++ b/apps/generer-arbeidsforhold-populasjon-service/src/test/resources/application-test.yml @@ -1,4 +1,5 @@ AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder +AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder TOKEN_X_ISSUER: dummy spring: diff --git a/apps/inntektsmelding-generator-service/src/test/java/no/nav/testnav/inntektsmeldinggeneratorservice/ApplicationContextTest.java b/apps/inntektsmelding-generator-service/src/test/java/no/nav/testnav/inntektsmeldinggeneratorservice/ApplicationContextTest.java index 3281df17537..534799e6dab 100644 --- a/apps/inntektsmelding-generator-service/src/test/java/no/nav/testnav/inntektsmeldinggeneratorservice/ApplicationContextTest.java +++ b/apps/inntektsmelding-generator-service/src/test/java/no/nav/testnav/inntektsmeldinggeneratorservice/ApplicationContextTest.java @@ -4,21 +4,21 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + @ActiveProfiles("test") @SpringBootTest -public class ApplicationContextTest { - - @MockBean - public JwtDecoder jwtDecoder; +class ApplicationContextTest { @MockBean + @SuppressWarnings("unused") public MapperFacade mapperFacade; @Test - @SuppressWarnings("java:S2699") void load_app_context() { + assertThat(true).isTrue(); } + } diff --git a/apps/inntektsmelding-generator-service/src/test/resources/application-test.yml b/apps/inntektsmelding-generator-service/src/test/resources/application-test.yml index 09e586a7980..c247f2ad542 100644 --- a/apps/inntektsmelding-generator-service/src/test/resources/application-test.yml +++ b/apps/inntektsmelding-generator-service/src/test/resources/application-test.yml @@ -1,3 +1,4 @@ +AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder TOKEN_X_ISSUER: dummy spring: diff --git a/apps/kodeverk-service/src/test/java/no/nav/testnav/kodeverkservice/ApplicationContextTest.java b/apps/kodeverk-service/src/test/java/no/nav/testnav/kodeverkservice/ApplicationContextTest.java index f277d06fc62..341d0d5583b 100644 --- a/apps/kodeverk-service/src/test/java/no/nav/testnav/kodeverkservice/ApplicationContextTest.java +++ b/apps/kodeverk-service/src/test/java/no/nav/testnav/kodeverkservice/ApplicationContextTest.java @@ -1,24 +1,18 @@ package no.nav.testnav.kodeverkservice; -import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; @SpringBootTest @ActiveProfiles("test") -public class ApplicationContextTest { - - @MockBean - public JwtDecoder jwtDecoder; +class ApplicationContextTest { @Test - @DisplayName("Application context should load") void load_app_context() { assertThat(true).isTrue(); } + } diff --git a/apps/kodeverk-service/src/test/resources/application-test.yml b/apps/kodeverk-service/src/test/resources/application-test.yml index a69fa740f61..70b074dc087 100644 --- a/apps/kodeverk-service/src/test/resources/application-test.yml +++ b/apps/kodeverk-service/src/test/resources/application-test.yml @@ -1,4 +1,5 @@ AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder +AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder spring: cloud: diff --git a/apps/levende-arbeidsforhold-ansettelse/src/test/java/no/nav/testnav/levendearbeidsforholdansettelse/LevendeArbeidsforholdAnsettelseApplicationTests.java b/apps/levende-arbeidsforhold-ansettelse/src/test/java/no/nav/testnav/levendearbeidsforholdansettelse/LevendeArbeidsforholdAnsettelseApplicationTests.java index bfc00a93a64..1dfa258ae9e 100644 --- a/apps/levende-arbeidsforhold-ansettelse/src/test/java/no/nav/testnav/levendearbeidsforholdansettelse/LevendeArbeidsforholdAnsettelseApplicationTests.java +++ b/apps/levende-arbeidsforhold-ansettelse/src/test/java/no/nav/testnav/levendearbeidsforholdansettelse/LevendeArbeidsforholdAnsettelseApplicationTests.java @@ -3,9 +3,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.r2dbc.core.R2dbcEntityTemplate; -import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; import org.springframework.test.context.ActiveProfiles; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; @@ -14,17 +12,12 @@ @ActiveProfiles("test") class LevendeArbeidsforholdAnsettelseApplicationTests { - @MockBean - @SuppressWarnings("unused") - public ReactiveJwtDecoder jwtDecoder; - @Autowired private R2dbcEntityTemplate template; @Test void load_app_context() { - assertThat(template) - .isNotNull(); + assertThat(template).isNotNull(); } } diff --git a/apps/levende-arbeidsforhold-ansettelse/src/test/resources/application-test.yml b/apps/levende-arbeidsforhold-ansettelse/src/test/resources/application-test.yml index 09310c9f953..fd31a953be4 100644 --- a/apps/levende-arbeidsforhold-ansettelse/src/test/resources/application-test.yml +++ b/apps/levende-arbeidsforhold-ansettelse/src/test/resources/application-test.yml @@ -1,4 +1,5 @@ AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder +AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder spring: r2dbc: diff --git a/apps/levende-arbeidsforhold-scheduler/src/test/resources/application-test.yml b/apps/levende-arbeidsforhold-scheduler/src/test/resources/application-test.yml index a69fa740f61..70b074dc087 100644 --- a/apps/levende-arbeidsforhold-scheduler/src/test/resources/application-test.yml +++ b/apps/levende-arbeidsforhold-scheduler/src/test/resources/application-test.yml @@ -1,4 +1,5 @@ AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder +AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder spring: cloud: diff --git a/apps/levende-arbeidsforhold-service/src/test/java/no/nav/testnav/levendearbeidsforholdservice/ApplicationContextTest.java b/apps/levende-arbeidsforhold-service/src/test/java/no/nav/testnav/levendearbeidsforholdservice/ApplicationContextTest.java index 8f3a5ea5356..db33e70155b 100644 --- a/apps/levende-arbeidsforhold-service/src/test/java/no/nav/testnav/levendearbeidsforholdservice/ApplicationContextTest.java +++ b/apps/levende-arbeidsforhold-service/src/test/java/no/nav/testnav/levendearbeidsforholdservice/ApplicationContextTest.java @@ -2,19 +2,17 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + @SpringBootTest @ActiveProfiles("test") class ApplicationContextTest { - @MockBean - public JwtDecoder jwtDecoder; - @Test - @SuppressWarnings("java:S2699") void load_app_context() { + assertThat(true).isTrue(); } -} + +} \ No newline at end of file diff --git a/apps/levende-arbeidsforhold-service/src/test/resources/application-test.yml b/apps/levende-arbeidsforhold-service/src/test/resources/application-test.yml index a69fa740f61..70b074dc087 100644 --- a/apps/levende-arbeidsforhold-service/src/test/resources/application-test.yml +++ b/apps/levende-arbeidsforhold-service/src/test/resources/application-test.yml @@ -1,4 +1,5 @@ AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder +AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder spring: cloud: diff --git a/apps/organisasjon-mottak-service/src/test/java/no/nav/registre/testnorge/organisasjonmottak/ApplicationContextTest.java b/apps/organisasjon-mottak-service/src/test/java/no/nav/registre/testnorge/organisasjonmottak/ApplicationContextTest.java index c34645a7afd..d7618c2c5a5 100644 --- a/apps/organisasjon-mottak-service/src/test/java/no/nav/registre/testnorge/organisasjonmottak/ApplicationContextTest.java +++ b/apps/organisasjon-mottak-service/src/test/java/no/nav/registre/testnorge/organisasjonmottak/ApplicationContextTest.java @@ -1,10 +1,7 @@ package no.nav.registre.testnorge.organisasjonmottak; -import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; @@ -13,12 +10,7 @@ @ActiveProfiles("test") class ApplicationContextTest { - @MockBean - @SuppressWarnings("unused") - private JwtDecoder jwtDecoder; - @Test - @DisplayName("Application context should load") void load_app_context() { assertThat(true).isTrue(); } diff --git a/apps/organisasjon-mottak-service/src/test/resources/application-test.yml b/apps/organisasjon-mottak-service/src/test/resources/application-test.yml index f1d3b23848b..39d4850ba29 100644 --- a/apps/organisasjon-mottak-service/src/test/resources/application-test.yml +++ b/apps/organisasjon-mottak-service/src/test/resources/application-test.yml @@ -1,4 +1,5 @@ AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder +AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder TOKEN_X_ISSUER: dummy spring: diff --git a/apps/person-faste-data-service/src/test/java/no/nav/testnav/personfastedataservice/ApplicationContextTest.java b/apps/person-faste-data-service/src/test/java/no/nav/testnav/personfastedataservice/ApplicationContextTest.java index cb9ba64e65d..621682c9800 100644 --- a/apps/person-faste-data-service/src/test/java/no/nav/testnav/personfastedataservice/ApplicationContextTest.java +++ b/apps/person-faste-data-service/src/test/java/no/nav/testnav/personfastedataservice/ApplicationContextTest.java @@ -2,19 +2,17 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder; import org.springframework.test.context.ActiveProfiles; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + @SpringBootTest @ActiveProfiles("test") class ApplicationContextTest { - @MockBean - public ReactiveJwtDecoder jwtDecoder; - @Test - @SuppressWarnings("java:S2699") void load_app_context() { + assertThat(true).isTrue(); } + } diff --git a/apps/person-faste-data-service/src/test/resources/application-test.yml b/apps/person-faste-data-service/src/test/resources/application-test.yml index aa8bfa92394..198e40dc002 100644 --- a/apps/person-faste-data-service/src/test/resources/application-test.yml +++ b/apps/person-faste-data-service/src/test/resources/application-test.yml @@ -1,3 +1,4 @@ +AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder TOKEN_X_ISSUER: dummy spring: diff --git a/apps/profil-api/src/test/java/no/nav/registre/testnorge/profil/ApplicationContextTest.java b/apps/profil-api/src/test/java/no/nav/registre/testnorge/profil/ApplicationContextTest.java index 42873bbb9e3..c06dac535d9 100644 --- a/apps/profil-api/src/test/java/no/nav/registre/testnorge/profil/ApplicationContextTest.java +++ b/apps/profil-api/src/test/java/no/nav/registre/testnorge/profil/ApplicationContextTest.java @@ -2,19 +2,17 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + @SpringBootTest @ActiveProfiles("test") class ApplicationContextTest { - @MockBean - public JwtDecoder jwtDecoder; - @Test - @SuppressWarnings("java:S2699") void load_app_context() { + assertThat(true).isTrue(); } + } diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumerTest.java index da2d3262e83..95d23517546 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/ArbeidsforholdConsumerTest.java @@ -15,19 +15,15 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import reactor.core.publisher.Mono; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestArbeidsforholdDTO; -import static org.mockito.Mockito.when; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; @ActiveProfiles("test") @RunWith(SpringRunner.class) @@ -36,9 +32,6 @@ @AutoConfigureWireMock(port = 0) public class ArbeidsforholdConsumerTest { - @MockBean - private JwtDecoder jwtDecoder; - @MockBean private TokenExchange tokenService; @@ -48,10 +41,10 @@ public class ArbeidsforholdConsumerTest { @Autowired private ArbeidsforholdConsumer arbeidsforholdConsumer; - private static final String ident = "01019049945"; - private static final String orgnr = "123456789"; - private static final String arbeidsforholdId = "1"; - private static final String arbeidsforholdUrl = "(.*)/arbeidsforhold/api/v1/arbeidsforhold/" + ident + "/" + orgnr + "/" + arbeidsforholdId; + private static final String IDENT = "01019049945"; + private static final String ORGNR = "123456789"; + private static final String ARBEIDSFORHOLD_ID = "1"; + private static final String ARBEIDSFORHOLD_URL = "(.*)/arbeidsforhold/api/v1/arbeidsforhold/" + IDENT + "/" + ORGNR + "/" + ARBEIDSFORHOLD_ID; private ArbeidsforholdDTO arbeidsforholdResponse; @@ -59,20 +52,20 @@ public class ArbeidsforholdConsumerTest { public void before() { WireMock.reset(); when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); - arbeidsforholdResponse = getTestArbeidsforholdDTO(arbeidsforholdId, orgnr); + arbeidsforholdResponse = getTestArbeidsforholdDTO(ARBEIDSFORHOLD_ID, ORGNR); } @Test public void shouldGetArbeidsforhold() throws JsonProcessingException { stubArbeidsforhold(); - var response = arbeidsforholdConsumer.getArbeidsforhold(ident, orgnr, arbeidsforholdId); + var response = arbeidsforholdConsumer.getArbeidsforhold(IDENT, ORGNR, ARBEIDSFORHOLD_ID); assertThat(response).isNotNull().isEqualTo(arbeidsforholdResponse); } private void stubArbeidsforhold() throws JsonProcessingException { - stubFor(get(urlPathMatching(arbeidsforholdUrl)) + stubFor(get(urlPathMatching(ARBEIDSFORHOLD_URL)) .willReturn(ok() .withHeader("Content-Type", "application/json") .withBody(objectMapper.writeValueAsString(arbeidsforholdResponse)))); diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumerTest.java index 06e4636c8d3..8d34fe99ca2 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/HelsepersonellConsumerTest.java @@ -15,19 +15,15 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import reactor.core.publisher.Mono; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestLegeListeDTO; -import static org.mockito.Mockito.when; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; @ActiveProfiles("test") @RunWith(SpringRunner.class) @@ -36,9 +32,6 @@ @AutoConfigureWireMock(port = 0) public class HelsepersonellConsumerTest { - @MockBean - private JwtDecoder jwtDecoder; - @MockBean private TokenExchange tokenService; @@ -48,7 +41,7 @@ public class HelsepersonellConsumerTest { @Autowired private HelsepersonellConsumer helsepersonellConsumer; - private static final String helsepersonellUrl = "(.*)/testnav-helsepersonell/api/v1/helsepersonell"; + private static final String HELSEPERSONELL_URL = "(.*)/testnav-helsepersonell/api/v1/helsepersonell"; private HelsepersonellListeDTO helsepersonellResponse; @@ -67,11 +60,11 @@ public void shouldGetHelsepersonell() throws JsonProcessingException { assertThat(response).isNotNull(); assertThat(response.getList()).isNotNull().hasSize(1); - assertThat(response.getList().get(0).getIdent()).isNotNull().isEqualTo(helsepersonellResponse.getHelsepersonell().get(0).getFnr()); + assertThat(response.getList().getFirst().getIdent()).isNotNull().isEqualTo(helsepersonellResponse.getHelsepersonell().getFirst().getFnr()); } private void stubHelsepersonell() throws JsonProcessingException { - stubFor(get(urlPathMatching(helsepersonellUrl)) + stubFor(get(urlPathMatching(HELSEPERSONELL_URL)) .willReturn(ok() .withHeader("Content-Type", "application/json") .withBody(objectMapper.writeValueAsString(helsepersonellResponse)))); diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumerTest.java index c4d5863f604..7245c153b1c 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/OrganisasjonConsumerTest.java @@ -15,19 +15,15 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import reactor.core.publisher.Mono; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestOrganisasjonDTO; -import static org.mockito.Mockito.when; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; @ActiveProfiles("test") @RunWith(SpringRunner.class) @@ -36,9 +32,6 @@ @AutoConfigureWireMock(port = 0) public class OrganisasjonConsumerTest { - @MockBean - private JwtDecoder jwtDecoder; - @MockBean private TokenExchange tokenService; @@ -48,28 +41,28 @@ public class OrganisasjonConsumerTest { @Autowired private OrganisasjonConsumer organisasjonConsumer; - private static final String orgnr = "123456789"; - private static final String organisasjonUrl = "(.*)/organisasjon/api/v1/organisasjoner/" + orgnr; + private static final String ORGNR = "123456789"; + private static final String ORGANISASJON_URL = "(.*)/organisasjon/api/v1/organisasjoner/" + ORGNR; private OrganisasjonDTO organisasjonResponse; @Before public void before() { WireMock.reset(); when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); - organisasjonResponse = getTestOrganisasjonDTO(orgnr); + organisasjonResponse = getTestOrganisasjonDTO(ORGNR); } @Test public void shouldGetOrgansiasjon() throws JsonProcessingException { stubOrgansisasjon(); - var response = organisasjonConsumer.getOrganisasjon(orgnr); + var response = organisasjonConsumer.getOrganisasjon(ORGNR); assertThat(response).isNotNull().isEqualTo(organisasjonResponse); } private void stubOrgansisasjon() throws JsonProcessingException { - stubFor(get(urlPathMatching(organisasjonUrl)) + stubFor(get(urlPathMatching(ORGANISASJON_URL)) .willReturn(ok() .withHeader("Content-Type", "application/json") .withBody(objectMapper.writeValueAsString(organisasjonResponse)))); diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumerTest.java index e41ca52e23e..9056e2202c7 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/PdlProxyConsumerTest.java @@ -15,19 +15,15 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import reactor.core.publisher.Mono; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestPdlPerson; -import static org.mockito.Mockito.when; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; @ActiveProfiles("test") @RunWith(SpringRunner.class) @@ -36,9 +32,6 @@ @AutoConfigureWireMock(port = 0) public class PdlProxyConsumerTest { - @MockBean - private JwtDecoder jwtDecoder; - @MockBean private TokenExchange tokenService; @@ -48,22 +41,22 @@ public class PdlProxyConsumerTest { @Autowired private PdlProxyConsumer pdlProxyConsumer; - private static final String ident = "01019049945"; - private static final String pdlProxyUrl = "(.*)/pdl/pdl-api/graphql"; + private static final String IDENT = "01019049945"; + private static final String PDL_PROXY_URL = "(.*)/pdl/pdl-api/graphql"; private PdlPerson pdlResponse; @Before public void before() { WireMock.reset(); when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); - pdlResponse = getTestPdlPerson(ident); + pdlResponse = getTestPdlPerson(IDENT); } @Test public void shouldGetArbeidsforhold() throws JsonProcessingException { stubPdlProxy(); - var response = pdlProxyConsumer.getPdlPerson(ident); + var response = pdlProxyConsumer.getPdlPerson(IDENT); assertThat(response).isNotNull(); assertThat(response.getErrors()).isEmpty(); @@ -71,11 +64,11 @@ public void shouldGetArbeidsforhold() throws JsonProcessingException { assertThat(response.getData().getHentPerson().getFoedsel()).isEmpty(); assertThat(response.getData().getHentPerson().getNavn()).hasSize(1); assertThat(response.getData().getHentIdenter().getIdenter()).hasSize(1); - assertThat(response.getData().getHentIdenter().getIdenter().get(0).getIdent()).isEqualTo(ident); + assertThat(response.getData().getHentIdenter().getIdenter().getFirst().getIdent()).isEqualTo(IDENT); } private void stubPdlProxy() throws JsonProcessingException { - stubFor(post(urlPathMatching(pdlProxyUrl)) + stubFor(post(urlPathMatching(PDL_PROXY_URL)) .willReturn(ok() .withHeader("Content-Type", "application/json") .withBody(objectMapper.writeValueAsString(pdlResponse)))); diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumerTest.java index 9ba6c0c1b47..60efa10fca7 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SykemeldingConsumerTest.java @@ -1,6 +1,5 @@ package no.nav.testnav.apps.syntsykemeldingapi.consumer; -import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.client.WireMock; import no.nav.testnav.apps.syntsykemeldingapi.consumer.dto.SyntSykemeldingHistorikkDTO; import no.nav.testnav.apps.syntsykemeldingapi.domain.Arbeidsforhold; @@ -25,7 +24,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; @@ -35,16 +33,8 @@ import java.time.LocalDate; import java.util.Map; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; -import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestArbeidsforholdDTO; -import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestHistorikk; -import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestLegeListeDTO; -import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestOrganisasjonDTO; -import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestPdlPerson; +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.*; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.when; @@ -56,59 +46,47 @@ @AutoConfigureWireMock(port = 0) public class SykemeldingConsumerTest { - @MockBean - private JwtDecoder jwtDecoder; - @MockBean private TokenExchange tokenService; - @Autowired - private ObjectMapper objectMapper; - @Autowired private SykemeldingConsumer sykemeldingConsumer; - private static final String ident = "12345678910"; - private static final String orgnr = "123456789"; - private static final String arbeidsforholdId = "1"; - private static final String sykemeldingUrl = "(.*)/sykemelding/sykemelding/api/v1/sykemeldinger"; - - private SyntSykemeldingDTO dto; - private PdlPerson pdlResponse; - private ArbeidsforholdDTO arbeidsforholdResponse; - private OrganisasjonDTO organisasjonResponse; - private Map syntResponse; - private HelsepersonellListeDTO helsepersonellResponse; + private static final String IDENT = "12345678910"; + private static final String ORGNR = "123456789"; + private static final String ARBEIDSFORHOLD_ID = "1"; + private static final String SYKEMELDING_URL = "(.*)/sykemelding/sykemelding/api/v1/sykemeldinger"; + private SykemeldingDTO sykemeldingRequest; @Before public void setUp() { when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); - dto = SyntSykemeldingDTO.builder() - .arbeidsforholdId(arbeidsforholdId) - .ident(ident) - .orgnummer(orgnr) + SyntSykemeldingDTO dto = SyntSykemeldingDTO.builder() + .arbeidsforholdId(ARBEIDSFORHOLD_ID) + .ident(IDENT) + .orgnummer(ORGNR) .startDato(LocalDate.now()) .build(); - pdlResponse = getTestPdlPerson(ident); - arbeidsforholdResponse = getTestArbeidsforholdDTO(arbeidsforholdId, orgnr); - organisasjonResponse = getTestOrganisasjonDTO(orgnr); + PdlPerson pdlResponse = getTestPdlPerson(IDENT); + ArbeidsforholdDTO arbeidsforholdResponse = getTestArbeidsforholdDTO(ARBEIDSFORHOLD_ID, ORGNR); + OrganisasjonDTO organisasjonResponse = getTestOrganisasjonDTO(ORGNR); var arbeidsforhold = new Arbeidsforhold( arbeidsforholdResponse, organisasjonResponse ); - syntResponse = getTestHistorikk(ident); - helsepersonellResponse = getTestLegeListeDTO(); + Map syntResponse = getTestHistorikk(IDENT); + HelsepersonellListeDTO helsepersonellResponse = getTestLegeListeDTO(); sykemeldingRequest = new Sykemelding( new Person(pdlResponse), - syntResponse.get(ident), + syntResponse.get(IDENT), dto, - new Helsepersonell(helsepersonellResponse.getHelsepersonell().get(0)), + new Helsepersonell(helsepersonellResponse.getHelsepersonell().getFirst()), arbeidsforhold).toDTO(); } @@ -130,11 +108,11 @@ public void shouldGetFeil() { } private void stubSykemelding() { - stubFor(post(urlPathMatching(sykemeldingUrl)).willReturn(ok())); + stubFor(post(urlPathMatching(SYKEMELDING_URL)).willReturn(ok())); } private void stubSykemeldingError() { - stubFor(post(urlPathMatching(sykemeldingUrl)).willReturn(aResponse().withStatus(500))); + stubFor(post(urlPathMatching(SYKEMELDING_URL)).willReturn(aResponse().withStatus(500))); } } diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumerTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumerTest.java index e568818dcc9..517b90fa35c 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumerTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/consumer/SyntElsamConsumerTest.java @@ -15,7 +15,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; @@ -24,13 +23,10 @@ import java.time.LocalDate; import java.util.Map; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.ok; -import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static no.nav.testnav.apps.syntsykemeldingapi.util.TestUtil.getTestHistorikk; -import static org.mockito.Mockito.when; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.when; @ActiveProfiles("test") @RunWith(SpringRunner.class) @@ -39,9 +35,6 @@ @AutoConfigureWireMock(port = 0) public class SyntElsamConsumerTest { - @MockBean - private JwtDecoder jwtDecoder; - @MockBean private TokenExchange tokenService; @@ -51,28 +44,28 @@ public class SyntElsamConsumerTest { @Autowired private SyntElsamConsumer syntElsamConsumer; - private static final String ident = "01019049945"; - private static final String syntUrl = "(.*)/synt/api/v1/generate_sykmeldings_history_json"; + private static final String IDENT = "01019049945"; + private static final String SYNT_URL = "(.*)/synt/api/v1/generate_sykmeldings_history_json"; private Map syntResponse; @Before public void before() { WireMock.reset(); when(tokenService.exchange(ArgumentMatchers.any(ServerProperties.class))).thenReturn(Mono.just(new AccessToken("token"))); - syntResponse = getTestHistorikk(ident); + syntResponse = getTestHistorikk(IDENT); } @Test public void shouldGetSyntSykemelding() throws JsonProcessingException { stubSynt(); - var response = syntElsamConsumer.genererSykemeldinger(ident, LocalDate.now()); + var response = syntElsamConsumer.genererSykemeldinger(IDENT, LocalDate.now()); - assertThat(response).isNotNull().isEqualTo(syntResponse.get(ident)); + assertThat(response).isNotNull().isEqualTo(syntResponse.get(IDENT)); } private void stubSynt() throws JsonProcessingException { - stubFor(post(urlPathMatching(syntUrl)) + stubFor(post(urlPathMatching(SYNT_URL)) .willReturn(ok() .withHeader("Content-Type", "application/json") .withBody(objectMapper.writeValueAsString(syntResponse)))); diff --git a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/provider/SyntSykemeldingControllerIntegrationTest.java b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/provider/SyntSykemeldingControllerIntegrationTest.java index 21bf2d37dc4..d2d18811d25 100644 --- a/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/provider/SyntSykemeldingControllerIntegrationTest.java +++ b/apps/synt-sykemelding-api/src/test/java/no/nav/testnav/apps/syntsykemeldingapi/provider/SyntSykemeldingControllerIntegrationTest.java @@ -18,7 +18,6 @@ import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.MockMvc; import reactor.core.publisher.Mono; @@ -41,10 +40,6 @@ @AutoConfigureWireMock(port = 0) class SyntSykemeldingControllerIntegrationTest { - @MockBean - @SuppressWarnings("unused") - private JwtDecoder jwtDecoder; - @Autowired private MockMvc mockMvc; diff --git a/apps/synt-sykemelding-api/src/test/resources/application-test.yml b/apps/synt-sykemelding-api/src/test/resources/application-test.yml index 0c8f756eae8..25d79707ee9 100644 --- a/apps/synt-sykemelding-api/src/test/resources/application-test.yml +++ b/apps/synt-sykemelding-api/src/test/resources/application-test.yml @@ -1,3 +1,4 @@ +AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder TOKEN_X_ISSUER: dummy wiremock: diff --git a/apps/testnav-ident-pool/src/test/java/no/nav/testnav/identpool/ComponentTestConfig.java b/apps/testnav-ident-pool/src/test/java/no/nav/testnav/identpool/ComponentTestConfig.java index c8b8c1e41c8..6342cf543d7 100644 --- a/apps/testnav-ident-pool/src/test/java/no/nav/testnav/identpool/ComponentTestConfig.java +++ b/apps/testnav-ident-pool/src/test/java/no/nav/testnav/identpool/ComponentTestConfig.java @@ -4,15 +4,13 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import org.springframework.security.oauth2.jwt.JwtDecoder; @Configuration @ComponentScan(basePackages = "no.nav.testnav.identpool") public class ComponentTestConfig { @MockBean - protected JwtDecoder jwtDecoder; - - @MockBean + @SuppressWarnings("unused") protected CronJobService cronJobService; + } diff --git a/apps/testnav-ident-pool/src/test/resources/application-test.yml b/apps/testnav-ident-pool/src/test/resources/application-test.yml index 3a37416d543..14d3f1658c1 100644 --- a/apps/testnav-ident-pool/src/test/resources/application-test.yml +++ b/apps/testnav-ident-pool/src/test/resources/application-test.yml @@ -1,4 +1,4 @@ -AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder +AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder TOKEN_X_ISSUER: dummy ### DATABASE ### diff --git a/apps/tps-messaging-service/src/test/java/no/nav/testnav/apps/tpsmessagingservice/ApplicationContextTest.java b/apps/tps-messaging-service/src/test/java/no/nav/testnav/apps/tpsmessagingservice/ApplicationContextTest.java index 90ed768d9e0..6ed2956beba 100644 --- a/apps/tps-messaging-service/src/test/java/no/nav/testnav/apps/tpsmessagingservice/ApplicationContextTest.java +++ b/apps/tps-messaging-service/src/test/java/no/nav/testnav/apps/tpsmessagingservice/ApplicationContextTest.java @@ -2,8 +2,6 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; @@ -12,10 +10,6 @@ @ActiveProfiles("test") class ApplicationContextTest { - @MockBean - @SuppressWarnings("unused") - private JwtDecoder jwtDecoder; - @Test void loadAppContext() { assertThat(true).isTrue(); diff --git a/apps/udi-stub/src/test/java/no/nav/udistub/converter/itest/UdiStubITest.java b/apps/udi-stub/src/test/java/no/nav/udistub/converter/itest/UdiStubITest.java index 54170daf2a5..72245e4329a 100644 --- a/apps/udi-stub/src/test/java/no/nav/udistub/converter/itest/UdiStubITest.java +++ b/apps/udi-stub/src/test/java/no/nav/udistub/converter/itest/UdiStubITest.java @@ -14,7 +14,6 @@ import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.core.io.ClassPathResource; import org.springframework.http.MediaType; -import org.springframework.security.oauth2.jwt.JwtDecoder; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; @@ -54,9 +53,7 @@ class UdiStubITest { protected static final UdiPerson TESTPERSON_UDI = createPersonTo(); - @MockBean - @SuppressWarnings("unused") - private JwtDecoder jwtDecoder; + @Autowired private PersonRepository personRepository; @Autowired diff --git a/apps/udi-stub/src/test/resources/application-test.yml b/apps/udi-stub/src/test/resources/application-test.yml index fe24f5b2071..585b27493c3 100644 --- a/apps/udi-stub/src/test/resources/application-test.yml +++ b/apps/udi-stub/src/test/resources/application-test.yml @@ -1,3 +1,4 @@ +AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder TOKEN_X_ISSUER: dummy spring: