VariableEventFilter { public boolean shouldEmmitEvent(ActivitiVariableEvent event) { return event.getTaskId() != null || event.getExecutionId().equals(event.getProcessInstanceId()); }  boolean shouldEmmitEvent(ActivitiVariableEvent event);  }
@Test public void should_emmitEvent_when_executionIdIsEqualsToProcessInstanceId() { ActivitiVariableEventImpl event = new ActivitiVariableEventImpl( ActivitiEventType.VARIABLE_CREATED); event.setExecutionId("id"); event.setProcessInstanceId("id"); boolean shouldEmmitEvent = variableEventFilter.shouldEmmitEvent( event); assertThat(shouldEmmitEvent).isTrue(); }
@Test public void shouldNot_emmitEvent_when_executionIdIsNotEqualsToProcessInstanceIdAndTaskIdIsNotSet() { ActivitiVariableEventImpl event = new ActivitiVariableEventImpl( ActivitiEventType.VARIABLE_CREATED); event.setExecutionId("id"); event.setProcessInstanceId("anotherId"); boolean shouldEmmitEvent = variableEventFilter.shouldEmmitEvent( event); assertThat(shouldEmmitEvent).isFalse(); }
@Test public void should_EmmitEvent_when_executionIdIsNotEqualsToProcessInstanceIdAndTaskIdIsSet() { ActivitiVariableEventImpl event = new ActivitiVariableEventImpl( ActivitiEventType.VARIABLE_CREATED); event.setExecutionId("id"); event.setProcessInstanceId("anotherId"); event.setTaskId("taskId"); boolean shouldEmmitEvent = variableEventFilter.shouldEmmitEvent(event); assertThat(shouldEmmitEvent).isTrue(); }
@Test public void should_EmmitEvent_when_executionIdAndProcessInstanceIdAreNotSetAndTaskIdIsSet() { ActivitiVariableEventImpl event = new ActivitiVariableEventImpl( ActivitiEventType.VARIABLE_CREATED); event.setExecutionId(null); event.setProcessInstanceId(null); event.setTaskId("taskId"); boolean shouldEmmitEvent = variableEventFilter.shouldEmmitEvent(event); assertThat(shouldEmmitEvent).isTrue(); }