diff --git a/eno-core/src/main/java/fr/insee/eno/core/utils/LunaticUtils.java b/eno-core/src/main/java/fr/insee/eno/core/utils/LunaticUtils.java index 6e8f76aba..d76493942 100644 --- a/eno-core/src/main/java/fr/insee/eno/core/utils/LunaticUtils.java +++ b/eno-core/src/main/java/fr/insee/eno/core/utils/LunaticUtils.java @@ -117,8 +117,8 @@ public static List getCollectedVariablesInLoop(Loop loop) { List result = new ArrayList<>(); loop.getComponents().forEach(component -> { switch (component.getComponentType()) { - case CHECKBOX_BOOLEAN, INPUT_NUMBER, INPUT, TEXTAREA, DATEPICKER, RADIO, CHECKBOX_ONE, DROPDOWN, - CHECKBOX_GROUP, TABLE -> + case CHECKBOX_BOOLEAN, INPUT_NUMBER, INPUT, TEXTAREA, DATEPICKER, DURATION, RADIO, + CHECKBOX_ONE, DROPDOWN, CHECKBOX_GROUP, TABLE -> result.addAll(getDirectResponseNames(component)); case ROSTER_FOR_LOOP -> throw new LunaticLoopException(String.format( @@ -133,8 +133,8 @@ public static List getCollectedVariablesInLoop(Loop loop) { "Pairwise components are forbidden in loops: loop '%s' contains a pairwise component.", loop.getId())); default -> - log.debug("(Variables in Lunatic loop) Component of type {} has no response.", - component.getComponentType()); + throw new IllegalArgumentException( + "Unexpected component type '" + component.getComponentType() + "'."); } }); return result; diff --git a/eno-core/src/test/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticLoopResizingLogicTest.java b/eno-core/src/test/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticLoopResizingLogicTest.java index 872aed90b..b65007f19 100644 --- a/eno-core/src/test/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticLoopResizingLogicTest.java +++ b/eno-core/src/test/java/fr/insee/eno/core/processing/out/steps/lunatic/resizing/LunaticLoopResizingLogicTest.java @@ -136,6 +136,11 @@ void simpleResponseComponents_resizedVariables() { datepicker.setResponse(new ResponseType()); datepicker.getResponse().setName("DATE_VAR"); lunaticLoop.getComponents().add(datepicker); + Duration duration = new Duration(); + duration.setComponentType(ComponentTypeEnum.DURATION); + duration.setResponse(new ResponseType()); + duration.getResponse().setName("DURATION_VAR"); + lunaticLoop.getComponents().add(duration); Dropdown dropdown = new Dropdown(); dropdown.setComponentType(ComponentTypeEnum.DROPDOWN); dropdown.setResponse(new ResponseType()); @@ -160,7 +165,7 @@ void simpleResponseComponents_resizedVariables() { // Then assertThat(lunaticResizing.getResizingEntry("LOOP_SIZE_VAR").getVariables()) .containsExactlyInAnyOrderElementsOf(Set.of( - "BOOLEAN_VAR", "INPUT_VAR", "TEXT_VAR", "NUMBER_VAR", "DATE_VAR", + "BOOLEAN_VAR", "INPUT_VAR", "TEXT_VAR", "NUMBER_VAR", "DATE_VAR", "DURATION_VAR", "DROPDOWN_VAR", "RADIO_VAR", "CHECKBOX_VAR")); }