Skip to content

Commit

Permalink
- Removed boilerplate JwtDecoder mocks.
Browse files Browse the repository at this point in the history
- Added missing test profile config placeholders.
- Removed a few Sonar warnings.
  • Loading branch information
rfc3092 committed Jan 9, 2025
1 parent cc0189d commit 69def70
Show file tree
Hide file tree
Showing 35 changed files with 115 additions and 208 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
DOLLY_READER_TOKEN: test
TOKEN_X_ISSUER: dummy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder
TOKEN_X_ISSUER: dummy

spring:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder
TOKEN_X_ISSUER: dummy

spring:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
TOKEN_X_ISSUER: dummy

spring:
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder

spring:
cloud:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder

spring:
r2dbc:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder

spring:
cloud:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder

spring:
cloud:
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
AZURE_OPENID_CONFIG_TOKEN_ENDPOINT: http://localhost/placeholder
TOKEN_X_ISSUER: dummy

spring:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
AZURE_OPENID_CONFIG_ISSUER: http://localhost/placeholder
TOKEN_X_ISSUER: dummy

spring:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Loading

0 comments on commit 69def70

Please sign in to comment.