-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: calculated expression for dynamic table size (#1148)
- Loading branch information
Showing
9 changed files
with
1,197 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ java { | |
|
||
allprojects { | ||
group = "fr.insee.eno" | ||
version = "3.28.0" | ||
version = "3.29.0" | ||
} | ||
|
||
subprojects { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
eno-core/src/test/java/fr/insee/eno/core/mapping/in/ddi/DynamicTableQuestionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package fr.insee.eno.core.mapping.in.ddi; | ||
|
||
import fr.insee.eno.core.exceptions.business.DDIParsingException; | ||
import fr.insee.eno.core.mappers.DDIMapper; | ||
import fr.insee.eno.core.model.EnoQuestionnaire; | ||
import fr.insee.eno.core.model.question.DynamicTableQuestion; | ||
import fr.insee.eno.core.serialize.DDIDeserializer; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.math.BigInteger; | ||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class DynamicTableQuestionTest { | ||
|
||
@Test | ||
void integrationTest_tableSize() throws DDIParsingException { | ||
// Given + When | ||
EnoQuestionnaire enoQuestionnaire = new EnoQuestionnaire(); | ||
new DDIMapper().mapDDI( | ||
DDIDeserializer.deserialize(this.getClass().getClassLoader().getResourceAsStream( | ||
"integration/ddi/ddi-dynamic-table-size.xml")), | ||
enoQuestionnaire); | ||
|
||
// Then | ||
List<DynamicTableQuestion> dynamicTableQuestions = enoQuestionnaire.getMultipleResponseQuestions().stream() | ||
.filter(DynamicTableQuestion.class::isInstance).map(DynamicTableQuestion.class::cast).toList(); | ||
assertEquals(2, dynamicTableQuestions.size()); | ||
DynamicTableQuestion dynamicTableQuestion1 = dynamicTableQuestions.get(0); | ||
DynamicTableQuestion dynamicTableQuestion2 = dynamicTableQuestions.get(1); | ||
// | ||
assertEquals(BigInteger.valueOf(1), dynamicTableQuestion1.getMinLines()); | ||
assertEquals(BigInteger.valueOf(5), dynamicTableQuestion1.getMaxLines()); | ||
assertNull(dynamicTableQuestion1.getSizeExpression()); | ||
// | ||
assertEquals(BigInteger.valueOf(1), dynamicTableQuestion2.getMinLines()); | ||
assertNull(dynamicTableQuestion2.getMaxLines()); | ||
assertNotNull(dynamicTableQuestion2.getSizeExpression()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.