Search in sources :

Example 6 with FactMappingValidationError

use of org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError in project drools-wb by kiegroup.

the class ScenarioSimulationEditorPresenterTest method getValidationCallback.

@Test
public void getValidationCallback() {
    presenterSpy.getValidationCallback().callback(null);
    verify(confirmPopupPresenterMock, never()).show(anyString(), anyString());
    List<FactMappingValidationError> validationErrors = new ArrayList<>();
    presenterSpy.getValidationCallback().callback(validationErrors);
    verify(confirmPopupPresenterMock, never()).show(anyString(), anyString());
    String errorMessage = "errorMessage";
    String errorId = "errorId";
    String errorId2 = "errorId2";
    validationErrors.add(new FactMappingValidationError(errorId, errorMessage));
    validationErrors.add(new FactMappingValidationError("errorId2", ScenarioSimulationI18nServerMessage.SCENARIO_VALIDATION_NODE_CHANGED_ERROR, "p1", "p2"));
    presenterSpy.getValidationCallback().callback(validationErrors);
    verify(confirmPopupPresenterMock, times(1)).show(anyString(), contains(errorId));
    verify(confirmPopupPresenterMock, times(1)).show(anyString(), contains(errorMessage));
    verify(confirmPopupPresenterMock, times(1)).show(anyString(), contains(errorId2));
    verify(confirmPopupPresenterMock, times(1)).show(anyString(), contains(ScenarioSimulationEditorConstants.INSTANCE.scenarioValidationNodeChangedError("p1", "p2")));
}
Also used : FactMappingValidationError(org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError) ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 7 with FactMappingValidationError

use of org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError in project drools-wb by kiegroup.

the class ScenarioSimulationEditorI18nServerManagerTest method retrieveMessageFieldRemovedConstraint.

@Test
public void retrieveMessageFieldRemovedConstraint() {
    FactMappingValidationError error = FactMappingValidationError.createFieldRemovedConstraintError(factMapping);
    String message = ScenarioSimulationEditorI18nServerManager.retrieveMessage(error);
    String expected = ScenarioSimulationEditorConstants.INSTANCE.scenarioValidationFieldRemovedConstraintError();
    assertEquals(expected, message);
}
Also used : FactMappingValidationError(org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError) Test(org.junit.Test)

Example 8 with FactMappingValidationError

use of org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError in project drools-wb by kiegroup.

the class ScenarioSimulationEditorI18nServerManagerTest method retrieveMessageNodeChangedError.

@Test
public void retrieveMessageNodeChangedError() {
    String newType = "newType";
    FactMappingValidationError error = FactMappingValidationError.createNodeChangedError(factMapping, newType);
    String message = ScenarioSimulationEditorI18nServerManager.retrieveMessage(error);
    String expected = ScenarioSimulationEditorConstants.INSTANCE.scenarioValidationNodeChangedError("tMYTYPE", newType);
    assertEquals(expected, message);
}
Also used : FactMappingValidationError(org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError) Test(org.junit.Test)

Example 9 with FactMappingValidationError

use of org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError in project drools-wb by kiegroup.

the class ScenarioSimulationEditorI18nServerManagerTest method retrieveMessageFieldAddedConstraint.

@Test
public void retrieveMessageFieldAddedConstraint() {
    FactMappingValidationError error = FactMappingValidationError.createFieldAddedConstraintError(factMapping);
    String message = ScenarioSimulationEditorI18nServerManager.retrieveMessage(error);
    String expected = ScenarioSimulationEditorConstants.INSTANCE.scenarioValidationFieldAddedConstraintError();
    assertEquals(expected, message);
}
Also used : FactMappingValidationError(org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError) Test(org.junit.Test)

Aggregations

FactMappingValidationError (org.drools.workbench.screens.scenariosimulation.model.FactMappingValidationError)9 Test (org.junit.Test)7 FactMapping (org.drools.scenariosimulation.api.model.FactMapping)4 ArrayList (java.util.ArrayList)3 List (java.util.List)2 FactIdentifier (org.drools.scenariosimulation.api.model.FactIdentifier)2 Simulation (org.drools.scenariosimulation.api.model.Simulation)2 DMNModel (org.kie.dmn.api.core.DMNModel)2 DMNType (org.kie.dmn.api.core.DMNType)2 HashMap (java.util.HashMap)1 ScenarioException (org.drools.scenariosimulation.backend.runner.ScenarioException)1 DMNSimulationUtils.extractDMNModel (org.drools.scenariosimulation.backend.util.DMNSimulationUtils.extractDMNModel)1 ScenarioBeanUtil.navigateToObject (org.drools.scenariosimulation.backend.util.ScenarioBeanUtil.navigateToObject)1 DMNUtils.navigateDMNType (org.drools.workbench.screens.scenariosimulation.backend.server.util.DMNUtils.navigateDMNType)1 KieContainer (org.kie.api.runtime.KieContainer)1 UnaryTestImpl (org.kie.dmn.feel.runtime.UnaryTestImpl)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 Matchers.anyString (org.mockito.Matchers.anyString)1