From 19737613e5294d4b77deae994c4526e776814d53 Mon Sep 17 00:00:00 2001 From: "sonarqube-agent[bot]" <210722872+sonarqube-agent[bot]@users.noreply.github.com> Date: Fri, 8 May 2026 09:04:41 +0000 Subject: [PATCH] fix: Address SonarQube issues Generated by SonarQube Agent (task: 974e3a55-839e-4e98-9064-3cf52f9f25aa) --- .../model/edxlhandler/EdxlHandlerTest.java | 22 +++++++++---------- .../validator/EnvelopeValidatorTest.java | 6 ++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/test/java/com/hubsante/model/edxlhandler/EdxlHandlerTest.java b/src/test/java/com/hubsante/model/edxlhandler/EdxlHandlerTest.java index 814b5d3b4..f898b2cd8 100644 --- a/src/test/java/com/hubsante/model/edxlhandler/EdxlHandlerTest.java +++ b/src/test/java/com/hubsante/model/edxlhandler/EdxlHandlerTest.java @@ -59,7 +59,7 @@ import static org.junit.jupiter.api.Assertions.*; @Slf4j -public class EdxlHandlerTest extends AbstractEdxlHandlerTest { +class EdxlHandlerTest extends AbstractEdxlHandlerTest { private static final String[] useCasesWithNoRcDe = { "RS-ERROR" @@ -67,7 +67,7 @@ public class EdxlHandlerTest extends AbstractEdxlHandlerTest { @Test @DisplayName("should consistently deserialize EDXL with several content objects") - public void deserializeEDXLWithSeveralContentObjects() throws IOException { + void deserializeEDXLWithSeveralContentObjects() throws IOException { String json = getMessageString("EDXL-DE"); EdxlMessage message = converter.deserializeJsonEDXL(json); @@ -78,7 +78,7 @@ public void deserializeEDXLWithSeveralContentObjects() throws IOException { @Test @DisplayName("should add XML prefix") - public void verifyXmlPrefix() throws IOException { + void verifyXmlPrefix() throws IOException { String json = getMessageByFileName("TECHNICAL/complete.json"); EdxlMessage messageFromInput = converter.deserializeJsonEDXL(json); String xml = converter.serializeXmlEDXL(messageFromInput); @@ -87,7 +87,7 @@ public void verifyXmlPrefix() throws IOException { @Test @DisplayName("should deserialize complete message with EDXL-DE envelope") - public void deserializeCompleteMessages() throws IOException { + void deserializeCompleteMessages() throws IOException { File jsonMessage = new File(TestMessagesHelper.class.getClassLoader().getResource("sample/valid/EDXL-DE/EDXL-DE.json").getFile()); String useCaseJson = new String(Files.readAllBytes(jsonMessage.toPath()), StandardCharsets.UTF_8); EdxlMessage message = converter.deserializeJsonEDXL(useCaseJson); @@ -99,7 +99,7 @@ public void deserializeCompleteMessages() throws IOException { @Test @DisplayName("all examples files deserializing") - public void examplesBundlePassingTest() { + void examplesBundlePassingTest() { String rootFolder = TestMessagesHelper.class.getClassLoader().getResource("sample/examples").getFile(); File[] subFolders = new File(rootFolder).listFiles(File::isDirectory); assert subFolders != null; @@ -146,7 +146,7 @@ public void examplesBundlePassingTest() { @Test @Disabled // ToDo(SSV): remove when recette Excel is up-to-date @DisplayName("all auto-generated test-case reception step files passing") - public void autoGeneratedTestCasesPassingTest() throws IOException, URISyntaxException { + void autoGeneratedTestCasesPassingTest() throws IOException, URISyntaxException { // Get all files from resources/test-cases URI uri = Objects.requireNonNull(getClass().getClassLoader().getResource("test-cases")).toURI(); Path path = Paths.get(uri); @@ -185,14 +185,14 @@ public void autoGeneratedTestCasesPassingTest() throws IOException, URISyntaxExc @Test @DisplayName("deserialization of a message with an unknown additional property not at root level fails") - public void deserializationOfMessageWithUnknownPropertyNotAtRootLevelFails() throws IOException { + void deserializationOfMessageWithUnknownPropertyNotAtRootLevelFails() throws IOException { String json = getInvalidMessage("EDXL-DE/unknown-property-deep.json"); assertThrows(UnrecognizedPropertyException.class, () -> converter.deserializeJsonEDXL(json)); } @Test @DisplayName("all json example files deserialize to same object xml example files deserialize to") - public void jsonAndXmlExampleFilesDeserializeToSameObject() { + void jsonAndXmlExampleFilesDeserializeToSameObject() { String rootFolder = TestMessagesHelper.class.getClassLoader().getResource("sample/examples").getFile(); File[] subFolders = new File(rootFolder).listFiles(File::isDirectory); @@ -239,7 +239,7 @@ public void jsonAndXmlExampleFilesDeserializeToSameObject() { @Test @DisplayName("serialized Xml EdxlMessages should contain xlink type") - public void serializedXmlEdxlMessagesShouldContainXlinkType() throws IOException { + void serializedXmlEdxlMessagesShouldContainXlinkType() throws IOException { File jsonMessage = new File(TestMessagesHelper.class.getClassLoader().getResource("sample/valid/RC-EDA/RC-EDA.json").getFile()); String json = new String(Files.readAllBytes(jsonMessage.toPath()), StandardCharsets.UTF_8); EdxlMessage message = converter.deserializeJsonEDXL(json); @@ -249,7 +249,7 @@ public void serializedXmlEdxlMessagesShouldContainXlinkType() throws IOException @Test @DisplayName("several content elements") - public void severalContentElements() throws IOException, ValidationException { + void severalContentElements() throws IOException, ValidationException { File jsonMessage = new File(TestMessagesHelper.class.getClassLoader().getResource("sample/valid/CustomContent/custom-content.json").getFile()); String json = new String(Files.readAllBytes(jsonMessage.toPath()), StandardCharsets.UTF_8); EdxlMessage message = converter.deserializeJsonEDXL(json); @@ -262,7 +262,7 @@ public void severalContentElements() throws IOException, ValidationException { @Test @DisplayName("XXE injection should succeed in vulnerable config and fail in safe config") - public void testXXEDifferentialBehavior() throws Exception { + void testXXEDifferentialBehavior() throws Exception { String xml = getInvalidMessage("EDXL-DE/external-entity.xml"); // Mapper vulnérable (sans protection) diff --git a/src/test/java/com/hubsante/model/validator/EnvelopeValidatorTest.java b/src/test/java/com/hubsante/model/validator/EnvelopeValidatorTest.java index ac0916b2c..5767f8a3f 100644 --- a/src/test/java/com/hubsante/model/validator/EnvelopeValidatorTest.java +++ b/src/test/java/com/hubsante/model/validator/EnvelopeValidatorTest.java @@ -33,13 +33,13 @@ import static com.hubsante.model.config.Constants.*; import static org.junit.jupiter.api.Assertions.*; -public class EnvelopeValidatorTest extends AbstractValidatorTest{ +class EnvelopeValidatorTest extends AbstractValidatorTest{ private static final Logger log = LoggerFactory.getLogger(EnvelopeValidatorTest.class); @Test @DisplayName("check EDXL envelope schemas availability") - public void checkEdxlEnvelopeSchemasAvailability() { + void checkEdxlEnvelopeSchemasAvailability() { assertDoesNotThrow(() -> new File(Thread.currentThread().getContextClassLoader() .getResource("json-schema/" + ENVELOPE_SCHEMA).getFile())); @@ -50,7 +50,7 @@ public void checkEdxlEnvelopeSchemasAvailability() { //region Fails validation @Test @DisplayName("All failing envelope tests must throw corresponding error messages") - public void batchFailingValidation() throws IOException { + void batchFailingValidation() throws IOException { boolean areAllTestsPassing = true; log.info("Running batch failing validation tests for schema: {}", "EDXL-DE"); String folderPath = Objects.requireNonNull(TestMessagesHelper.class.getClassLoader().getResource("sample/failing/EDXL-DE")).getFile();