Search in sources :

Example 1 with ModelValidator

use of org.kie.workbench.common.forms.processing.engine.handling.ModelValidator in project kie-wb-common by kiegroup.

the class FormValidatorImplTest method testModelAndFieldStateValidatorsCalled.

private void testModelAndFieldStateValidatorsCalled(boolean modelSuccess, boolean fieldStateSuccess) {
    ModelValidator modelValidator = mock(ModelValidator.class);
    when(modelValidator.validate(anyCollection(), any())).thenReturn(modelSuccess);
    when(fieldStateValidator.validate(anyCollection())).thenReturn(fieldStateSuccess);
    formValidator.setModelValidator(modelValidator);
    assertEquals(formValidator.validate(form, model), modelSuccess && fieldStateSuccess);
    verify(fieldStateValidator).validate(form.getFields());
    verify(modelValidator).validate(form.getFields(), model);
}
Also used : ModelValidator(org.kie.workbench.common.forms.processing.engine.handling.ModelValidator)

Example 2 with ModelValidator

use of org.kie.workbench.common.forms.processing.engine.handling.ModelValidator in project kie-wb-common by kiegroup.

the class FormValidatorImplTest method testSetModelValidator.

@Test
public void testSetModelValidator() {
    ModelValidator modelValidator = mock(ModelValidator.class);
    formValidator.setModelValidator(modelValidator);
    assertSame(formValidator.getModelValidator(), modelValidator);
}
Also used : ModelValidator(org.kie.workbench.common.forms.processing.engine.handling.ModelValidator) Test(org.junit.Test)

Aggregations

ModelValidator (org.kie.workbench.common.forms.processing.engine.handling.ModelValidator)2 Test (org.junit.Test)1