From b5ffed367d93967e570020a2f46a490d33409c64 Mon Sep 17 00:00:00 2001 From: Emmanuel DEMEY Date: Tue, 3 Dec 2024 14:59:18 +0000 Subject: [PATCH] fix: remove some sonar issues (#824) --- .../datasets/DatasetQueriesTest.java | 2 +- .../distribution/DistributionQueriesTest.java | 2 +- .../OperationsDocumentationsImplTest.java | 4 +-- .../DocumentationExportTest.java | 8 ++--- .../auth/security/RBACConfigurationTest.java | 2 +- ...aReportResourcesAuthorizationsEnvProd.java | 34 +++++++++---------- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/test/java/fr/insee/rmes/bauhaus_services/datasets/DatasetQueriesTest.java b/src/test/java/fr/insee/rmes/bauhaus_services/datasets/DatasetQueriesTest.java index f788dd74d..41a2e8ebe 100644 --- a/src/test/java/fr/insee/rmes/bauhaus_services/datasets/DatasetQueriesTest.java +++ b/src/test/java/fr/insee/rmes/bauhaus_services/datasets/DatasetQueriesTest.java @@ -16,7 +16,7 @@ import static org.mockito.ArgumentMatchers.eq; @SpringBootTest(properties = { "fr.insee.rmes.bauhaus.lg1=fr", "fr.insee.rmes.bauhaus.lg2=en"}) -public class DatasetQueriesTest { +class DatasetQueriesTest { @Autowired Config config; diff --git a/src/test/java/fr/insee/rmes/bauhaus_services/distribution/DistributionQueriesTest.java b/src/test/java/fr/insee/rmes/bauhaus_services/distribution/DistributionQueriesTest.java index ddb58b35e..f0dc161d9 100644 --- a/src/test/java/fr/insee/rmes/bauhaus_services/distribution/DistributionQueriesTest.java +++ b/src/test/java/fr/insee/rmes/bauhaus_services/distribution/DistributionQueriesTest.java @@ -16,7 +16,7 @@ import static org.mockito.ArgumentMatchers.eq; @SpringBootTest(properties = { "fr.insee.rmes.bauhaus.lg1=fr", "fr.insee.rmes.bauhaus.lg2=en"}) -public class DistributionQueriesTest { +class DistributionQueriesTest { @Autowired Config config; diff --git a/src/test/java/fr/insee/rmes/bauhaus_services/operations/OperationsDocumentationsImplTest.java b/src/test/java/fr/insee/rmes/bauhaus_services/operations/OperationsDocumentationsImplTest.java index aa6600ad0..2e09e3421 100644 --- a/src/test/java/fr/insee/rmes/bauhaus_services/operations/OperationsDocumentationsImplTest.java +++ b/src/test/java/fr/insee/rmes/bauhaus_services/operations/OperationsDocumentationsImplTest.java @@ -29,7 +29,7 @@ class OperationsDocumentationsImplTest { private OperationsDocumentationsImpl metadataReportService; @Test - public void testExportMetadataReport_Success() throws RmesException { + void testExportMetadataReport_Success() throws RmesException { String id = "1234"; boolean includeEmptyMas = true; boolean lg1 = true; @@ -45,7 +45,7 @@ public void testExportMetadataReport_Success() throws RmesException { } @Test - public void testExportMetadataReport_Failure_NoLanguageSelected() { + void testExportMetadataReport_Failure_NoLanguageSelected() { String id = "1234"; boolean includeEmptyMas = true; boolean lg1 = false; diff --git a/src/test/java/fr/insee/rmes/bauhaus_services/operations/documentations/DocumentationExportTest.java b/src/test/java/fr/insee/rmes/bauhaus_services/operations/documentations/DocumentationExportTest.java index 5c6456e73..3a5171cbc 100644 --- a/src/test/java/fr/insee/rmes/bauhaus_services/operations/documentations/DocumentationExportTest.java +++ b/src/test/java/fr/insee/rmes/bauhaus_services/operations/documentations/DocumentationExportTest.java @@ -65,7 +65,7 @@ class DocumentationExportTest { private DocumentsUtils documentsUtils; @Test - public void testExportAsZip_success() throws Exception { + void testExportAsZip_success() throws Exception { JSONObject document = new JSONObject(); document.put("url", "file://doc.doc"); document.put("id", "1"); @@ -98,7 +98,7 @@ public void testExportAsZip_success() throws Exception { } @Test - public void testExportMetadataReport_Success_WithoutDocuments_Label() throws RmesException { + void testExportMetadataReport_Success_WithoutDocuments_Label() throws RmesException { DocumentationExport documentationExport = new DocumentationExport(50, documentsUtils, exportUtils, seriesUtils, operationsUtils, indicatorsUtils, parentUtils, codeListService, organizationsService, documentationsUtils ); String id = "1234"; @@ -121,7 +121,7 @@ public void testExportMetadataReport_Success_WithoutDocuments_Label() throws Rm } @Test - public void testExportMetadataReport_Failure_UnknownGoal() throws RmesException { + void testExportMetadataReport_Failure_UnknownGoal() throws RmesException { DocumentationExport documentationExport = new DocumentationExport(50, documentsUtils, exportUtils, seriesUtils, operationsUtils, indicatorsUtils, parentUtils, codeListService, organizationsService, documentationsUtils ); String id = "1234"; @@ -142,7 +142,7 @@ public void testExportMetadataReport_Failure_UnknownGoal() throws RmesException } @Test - public void testExportXmlFiles_Success() throws RmesException { + void testExportXmlFiles_Success() throws RmesException { DocumentationExport documentationExport = new DocumentationExport(50, documentsUtils, exportUtils, seriesUtils, operationsUtils, indicatorsUtils, parentUtils, codeListService, organizationsService, documentationsUtils ); Map xmlContent = new HashMap<>(); diff --git a/src/test/java/fr/insee/rmes/config/auth/security/RBACConfigurationTest.java b/src/test/java/fr/insee/rmes/config/auth/security/RBACConfigurationTest.java index cc826915e..7caed8b9b 100644 --- a/src/test/java/fr/insee/rmes/config/auth/security/RBACConfigurationTest.java +++ b/src/test/java/fr/insee/rmes/config/auth/security/RBACConfigurationTest.java @@ -11,7 +11,7 @@ @SpringBootTest(properties = "spring.config.additional-location=classpath:rbac.yml") @EnableConfigurationProperties(RBACConfiguration.class) -public class RBACConfigurationTest { +class RBACConfigurationTest { @Autowired private RBACConfiguration rbacConfiguration; diff --git a/src/test/java/fr/insee/rmes/integration/authorizations/TestMetadataReportResourcesAuthorizationsEnvProd.java b/src/test/java/fr/insee/rmes/integration/authorizations/TestMetadataReportResourcesAuthorizationsEnvProd.java index 448790015..7e32f26de 100644 --- a/src/test/java/fr/insee/rmes/integration/authorizations/TestMetadataReportResourcesAuthorizationsEnvProd.java +++ b/src/test/java/fr/insee/rmes/integration/authorizations/TestMetadataReportResourcesAuthorizationsEnvProd.java @@ -76,7 +76,7 @@ class TestMetadataReportResourcesAuthorizationsEnvProd { private final String timbre = "XX59-YYY"; @Test - public void testGetMSDJson() throws Exception { + void testGetMSDJson() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); String jsonResponse = "{\"key\":\"value\"}"; @@ -92,7 +92,7 @@ public void testGetMSDJson() throws Exception { } @Test - public void testGetMSDXml() throws Exception { + void testGetMSDXml() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); MSD msd = new MSD(); @@ -112,7 +112,7 @@ public void testGetMSDXml() throws Exception { } @Test - public void testGetMSDJsonRmesException() throws Exception { + void testGetMSDJsonRmesException() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); when(documentationsService.getMSDJson()).thenThrow(new RmesException(HttpStatus.INTERNAL_SERVER_ERROR, "Error", "Detailed error message")); @@ -124,7 +124,7 @@ public void testGetMSDJsonRmesException() throws Exception { } @Test - public void testGetMSDXmlRmesException() throws Exception { + void testGetMSDXmlRmesException() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); when(documentationsService.getMSD()).thenThrow(new RmesException(HttpStatus.INTERNAL_SERVER_ERROR, "Error", "Detailed error message")); @@ -137,7 +137,7 @@ public void testGetMSDXmlRmesException() throws Exception { @Test - public void testGetMetadataAttribute() throws Exception { + void testGetMetadataAttribute() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); String id = "testId"; @@ -154,7 +154,7 @@ public void testGetMetadataAttribute() throws Exception { } @Test - public void testGetMetadataAttributeRmesException() throws Exception { + void testGetMetadataAttributeRmesException() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); String id = "testId"; @@ -168,7 +168,7 @@ public void testGetMetadataAttributeRmesException() throws Exception { } @Test - public void testGetMetadataAttributes() throws Exception { + void testGetMetadataAttributes() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); String jsonResponse = "{\"key\":\"value\"}"; @@ -184,7 +184,7 @@ public void testGetMetadataAttributes() throws Exception { } @Test - public void testGetMetadataAttributesRmesException() throws Exception { + void testGetMetadataAttributesRmesException() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); when(documentationsService.getMetadataAttributes()).thenThrow(new RmesException(HttpStatus.INTERNAL_SERVER_ERROR, "Error", "Detailed error message")); @@ -196,7 +196,7 @@ public void testGetMetadataAttributesRmesException() throws Exception { } @Test - public void testGetMetadataReport() throws Exception { + void testGetMetadataReport() throws Exception { String id = "1234"; configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); @@ -213,7 +213,7 @@ public void testGetMetadataReport() throws Exception { } @Test - public void testGetMetadataReportRmesException() throws Exception { + void testGetMetadataReportRmesException() throws Exception { String id = "1234"; configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); @@ -225,7 +225,7 @@ public void testGetMetadataReportRmesException() throws Exception { .andExpect(status().isInternalServerError()); } @Test - public void testGetMetadataReportDefaultValue() throws Exception { + void testGetMetadataReportDefaultValue() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); String jsonResponse = "{\"key\":\"value\"}"; @@ -241,7 +241,7 @@ public void testGetMetadataReportDefaultValue() throws Exception { } @Test - public void testGetFullSimsJson() throws Exception { + void testGetFullSimsJson() throws Exception { String id = "1234"; configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); @@ -258,7 +258,7 @@ public void testGetFullSimsJson() throws Exception { } @Test - public void testGetFullSimsXml() throws Exception { + void testGetFullSimsXml() throws Exception { String id = "1234"; configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); @@ -279,7 +279,7 @@ public void testGetFullSimsXml() throws Exception { } @Test - public void testGetFullSimsJsonRmesException() throws Exception { + void testGetFullSimsJsonRmesException() throws Exception { String id = "1234"; configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); @@ -292,7 +292,7 @@ public void testGetFullSimsJsonRmesException() throws Exception { } @Test - public void testGetFullSimsXmlRmesException() throws Exception { + void testGetFullSimsXmlRmesException() throws Exception { String id = "1234"; configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); @@ -305,7 +305,7 @@ public void testGetFullSimsXmlRmesException() throws Exception { } @Test - public void testGetSimsExport() throws Exception { + void testGetSimsExport() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); String id = "1234"; @@ -331,7 +331,7 @@ public void testGetSimsExport() throws Exception { } @Test - public void testGetSimsExport_DefaultValues() throws Exception { + void testGetSimsExport_DefaultValues() throws Exception { configureJwtDecoderMock(jwtDecoder, idep, timbre, List.of(Roles.ADMIN)); String id = "1234";