Skip to content

Commit

Permalink
Add unit test with file without collected tag
Browse files Browse the repository at this point in the history
  • Loading branch information
loichenninger committed Sep 17, 2024
1 parent 98b17ca commit c93f3ae
Show file tree
Hide file tree
Showing 5 changed files with 1,161 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,31 @@ void reset() throws IOException {
.resolve("data.complete.validated.STPDv2.20231122164209.xml")
);
}
//SAMPLETEST-NO-COLLECTED
if (!testResourcesPath
.resolve("IN")
.resolve("WEB")
.resolve("SAMPLETEST-NO-COLLECTED")
.resolve("differential")
.resolve("data")
.resolve("data_diff_no_collected.xml")
.toFile().exists()
){
Files.copy(
testResourcesPath
.resolve("IN")
.resolve("WEB")
.resolve("SAMPLETEST-NO-COLLECTED")
.resolve("data_diff_no_collected.xml")
, testResourcesPath
.resolve("IN")
.resolve("WEB")
.resolve("SAMPLETEST-NO-COLLECTED")
.resolve("differential")
.resolve("data")
.resolve("data_diff_no_collected.xml")
);
}
}


Expand All @@ -227,6 +252,17 @@ void saveResponseFromXMLFileTest() throws Exception {
Assertions.assertThat(surveyUnitUpdatePersistencePortStub.getMongoStub()).isNotEmpty();
}

@Test
void saveOneFileNoCollected_NoNullPointerException(){
Assertions.assertThatCode(() -> responseControllerStatic.saveResponsesFromXmlFile(
Path.of(TestConstants.TEST_RESOURCES_DIRECTORY, "IN/WEB/SAMPLETEST-NO-COLLECTED/differential/data/data_diff_no_collected.xml").toString()
, Path.of(TestConstants.TEST_RESOURCES_DIRECTORY, "specs/SAMPLETEST-NO-COLLECTED/WEB/ddi_response_simple.xml").toString()
, Mode.WEB
, true
)).doesNotThrowAnyException();

}

@Test
void saveResponsesFromXmlCampaignFolderTest() throws Exception {
responseControllerStatic.saveResponsesFromXmlCampaignFolder(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Campaign>
<Id>NOCOLLECTED</Id>
<Label>Traiter - Questions Simples</Label>
<SurveyUnits>
<SurveyUnit>
<Id>00000001</Id>
<QuestionnaireModelId>NOCOLLECTED</QuestionnaireModelId>
<Data>
<CALCULATED/>
<EXTERNAL/>
</Data>
</SurveyUnit>
</SurveyUnits>
</Campaign>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Campaign>
<Id>NOCOLLECTED</Id>
<Label>Traiter - Questions Simples</Label>
<SurveyUnits>
<SurveyUnit>
<Id>00000001</Id>
<QuestionnaireModelId>NOCOLLECTED</QuestionnaireModelId>
<Data>
<CALCULATED/>
<EXTERNAL/>
</Data>
</SurveyUnit>
</SurveyUnits>
</Campaign>
Loading

0 comments on commit c93f3ae

Please sign in to comment.