Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/test/java/com/hubsante/model/edxlhandler/EdxlHandlerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@
import static org.junit.jupiter.api.Assertions.*;

@Slf4j
public class EdxlHandlerTest extends AbstractEdxlHandlerTest {
class EdxlHandlerTest extends AbstractEdxlHandlerTest {

private static final String[] useCasesWithNoRcDe = {
"RS-ERROR"
};

@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);

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

Expand All @@ -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();
Expand Down
Loading