Search in sources :

Example 1 with ElementViolationImpl

use of org.kie.workbench.common.stunner.core.validation.impl.ElementViolationImpl in project kie-wb-common by kiegroup.

the class DMNClientDiagramValidatorTest method testOnValidatorSuccess.

@Test
public void testOnValidatorSuccess() {
    final ElementViolationImpl elementViolation = new ElementViolationImpl.Builder().build();
    final MarshallingMessage marshallingMessage = MarshallingMessage.builder().build();
    final Collection<DiagramElementViolation<RuleViolation>> diagramElementViolations = singletonList(elementViolation);
    final Collection<DomainViolation> response = singletonList(marshallingMessage);
    final Consumer<Collection<DiagramElementViolation<RuleViolation>>> resultConsumer = (collection) -> {
        assertEquals(1, collection.size());
    };
    validator.onValidatorSuccess(diagramElementViolations, resultConsumer).callback(response);
}
Also used : MarshallingMessage(org.kie.workbench.common.stunner.core.marshaller.MarshallingMessage) GwtMockitoTestRunner(com.google.gwtmockito.GwtMockitoTestRunner) MarshallingMessage(org.kie.workbench.common.stunner.core.marshaller.MarshallingMessage) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) DMNDomainValidator(org.kie.workbench.common.dmn.api.validation.DMNDomainValidator) CallerMock(org.uberfire.mocks.CallerMock) ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) Mock(org.mockito.Mock) ManagedInstance(org.jboss.errai.ioc.client.api.ManagedInstance) RunWith(org.junit.runner.RunWith) ClientRuntimeError(org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError) Mockito.spy(org.mockito.Mockito.spy) Collections.singletonList(java.util.Collections.singletonList) TreeWalkTraverseProcessor(org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessor) DiagramElementViolation(org.kie.workbench.common.stunner.core.validation.DiagramElementViolation) DomainViolation(org.kie.workbench.common.stunner.core.validation.DomainViolation) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) DefinitionManager(org.kie.workbench.common.stunner.core.api.DefinitionManager) Mockito.doReturn(org.mockito.Mockito.doReturn) ServiceCallback(org.kie.workbench.common.stunner.core.client.service.ServiceCallback) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Before(org.junit.Before) DomainValidator(org.kie.workbench.common.stunner.core.validation.DomainValidator) ElementViolationImpl(org.kie.workbench.common.stunner.core.validation.impl.ElementViolationImpl) Collection(java.util.Collection) ModelValidator(org.kie.workbench.common.stunner.core.validation.ModelValidator) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) Test(org.junit.Test) Mockito.doNothing(org.mockito.Mockito.doNothing) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) Consumer(java.util.function.Consumer) Mockito(org.mockito.Mockito) Mockito.never(org.mockito.Mockito.never) DMNMarshallerService(org.kie.workbench.common.dmn.client.marshaller.DMNMarshallerService) RuleManager(org.kie.workbench.common.stunner.core.rule.RuleManager) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) ElementViolationImpl(org.kie.workbench.common.stunner.core.validation.impl.ElementViolationImpl) DiagramElementViolation(org.kie.workbench.common.stunner.core.validation.DiagramElementViolation) Collection(java.util.Collection) RuleViolation(org.kie.workbench.common.stunner.core.rule.RuleViolation) DomainViolation(org.kie.workbench.common.stunner.core.validation.DomainViolation) Test(org.junit.Test)

Aggregations

GwtMockitoTestRunner (com.google.gwtmockito.GwtMockitoTestRunner)1 Collection (java.util.Collection)1 Collections.singletonList (java.util.Collections.singletonList)1 Consumer (java.util.function.Consumer)1 ErrorCallback (org.jboss.errai.common.client.api.ErrorCallback)1 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)1 ManagedInstance (org.jboss.errai.ioc.client.api.ManagedInstance)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Before (org.junit.Before)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 DMNDomainValidator (org.kie.workbench.common.dmn.api.validation.DMNDomainValidator)1 DMNMarshallerService (org.kie.workbench.common.dmn.client.marshaller.DMNMarshallerService)1 DefinitionManager (org.kie.workbench.common.stunner.core.api.DefinitionManager)1 ClientRuntimeError (org.kie.workbench.common.stunner.core.client.service.ClientRuntimeError)1 ServiceCallback (org.kie.workbench.common.stunner.core.client.service.ServiceCallback)1 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)1 TreeWalkTraverseProcessor (org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessor)1 MarshallingMessage (org.kie.workbench.common.stunner.core.marshaller.MarshallingMessage)1 RuleManager (org.kie.workbench.common.stunner.core.rule.RuleManager)1