DDMFormEvaluatorHelper { protected Set<Integer> getDisabledPagesIndexes() { Set<Integer> disabledPagesIndexes = new HashSet<>(); for (Map.Entry<Integer, Integer> entry : _pageFlow.entrySet()) { int fromPageIndex = entry.getKey(); int toPageIndex = entry.getValue(); for (int i = fromPageIndex + 1; i < toPageIndex; i++) { disabledPagesIndexes.add(i); } } return disabledPagesIndexes; } DDMFormEvaluatorHelper(
		DDMFormEvaluatorEvaluateRequest ddmFormEvaluatorEvaluateRequest,
		DDMExpressionFactory ddmExpressionFactory,
		DDMFormFieldTypeServicesTracker ddmFormFieldTypeServicesTracker); DDMFormEvaluatorEvaluateResponse evaluate();  }
@Test public void testJumpPageAction() throws Exception { DDMForm ddmForm = new DDMForm(); DDMFormField ddmFormField = createDDMFormField( "field0", "text", FieldConstants.NUMBER); ddmForm.addDDMFormField(ddmFormField); ddmForm.addDDMFormRule( new DDMFormRule( Arrays.asList("jumpPage(1, 3)"), "getValue(\"field0\") >= 1")); DDMFormValues ddmFormValues = DDMFormValuesTestUtil.createDDMFormValues( ddmForm); ddmFormValues.addDDMFormFieldValue( DDMFormValuesTestUtil.createDDMFormFieldValue( "field0_instanceId", "field0", new UnlocalizedValue("2"))); DDMFormEvaluatorEvaluateResponse ddmFormEvaluatorEvaluateResponse = doEvaluate(ddmForm, ddmFormValues); Set<Integer> disabledPagesIndexes = ddmFormEvaluatorEvaluateResponse.getDisabledPagesIndexes(); Assert.assertTrue( disabledPagesIndexes.toString(), disabledPagesIndexes.contains(2)); }
@Test public void testNotCalledJumpPageAction() throws Exception { DDMForm ddmForm = new DDMForm(); DDMFormField ddmFormField = createDDMFormField( "field0", "text", FieldConstants.NUMBER); ddmForm.addDDMFormField(ddmFormField); ddmForm.addDDMFormRule( new DDMFormRule( Arrays.asList("jumpPage(1, 3)"), "getValue(\"field0\") > 1")); DDMFormValues ddmFormValues = DDMFormValuesTestUtil.createDDMFormValues( ddmForm); ddmFormValues.addDDMFormFieldValue( DDMFormValuesTestUtil.createDDMFormFieldValue( "field0_instanceId", "field0", new UnlocalizedValue("1"))); DDMFormEvaluatorEvaluateResponse ddmFormEvaluatorEvaluateResponse = doEvaluate(ddmForm, ddmFormValues); Set<Integer> disabledPagesIndexes = ddmFormEvaluatorEvaluateResponse.getDisabledPagesIndexes(); Assert.assertTrue( disabledPagesIndexes.toString(), disabledPagesIndexes.isEmpty()); }