@Test public void should_returnEmpty_when_entityIsNotTask() { ActivitiEntityEventImpl internalEvent = new ActivitiEntityEventImpl(mock(ProcessInstance.class), ActivitiEventType.ENTITY_DELETED); Optional<TaskCancelledEvent> convertedTaskCancelledEvent = eventConverter.from(internalEvent); assertThat(convertedTaskCancelledEvent).isEmpty(); }
@Override public Optional<TaskCancelledEvent> from(ActivitiEntityEvent internalEvent) { TaskCancelledEvent event = null; if (isTaskCancelled(internalEvent)) { TaskEntity taskEntity = (TaskEntity) internalEvent.getEntity(); Task task = taskConverter.from(taskEntity, Task.TaskStatus.CANCELLED); String reason = internalEvent.getReason(); event = new TaskCancelledImpl(task, reason); } return Optional.ofNullable(event); }
ToTaskCancelledConverter implements EventConverter<TaskCancelledEvent, ActivitiEntityEvent> { @Override public Optional<TaskCancelledEvent> from(ActivitiEntityEvent internalEvent) { TaskCancelledEvent event = null; if (isTaskCancelled(internalEvent)) { TaskEntity taskEntity = (TaskEntity) internalEvent.getEntity(); Task task = taskConverter.from(taskEntity, Task.TaskStatus.CANCELLED); String reason = internalEvent.getReason(); event = new TaskCancelledImpl(task, reason); } return Optional.ofNullable(event); } }
ToTaskCancelledConverter implements EventConverter<TaskCancelledEvent, ActivitiEntityEvent> { @Override public Optional<TaskCancelledEvent> from(ActivitiEntityEvent internalEvent) { TaskCancelledEvent event = null; if (isTaskCancelled(internalEvent)) { TaskEntity taskEntity = (TaskEntity) internalEvent.getEntity(); Task task = taskConverter.from(taskEntity, Task.TaskStatus.CANCELLED); String reason = internalEvent.getReason(); event = new TaskCancelledImpl(task, reason); } return Optional.ofNullable(event); } ToTaskCancelledConverter(APITaskConverter taskConverter); }
ToTaskCancelledConverter implements EventConverter<TaskCancelledEvent, ActivitiEntityEvent> { @Override public Optional<TaskCancelledEvent> from(ActivitiEntityEvent internalEvent) { TaskCancelledEvent event = null; if (isTaskCancelled(internalEvent)) { TaskEntity taskEntity = (TaskEntity) internalEvent.getEntity(); Task task = taskConverter.from(taskEntity, Task.TaskStatus.CANCELLED); String reason = internalEvent.getReason(); event = new TaskCancelledImpl(task, reason); } return Optional.ofNullable(event); } ToTaskCancelledConverter(APITaskConverter taskConverter); @Override Optional<TaskCancelledEvent> from(ActivitiEntityEvent internalEvent); }
ToTaskCancelledConverter implements EventConverter<TaskCancelledEvent, ActivitiEntityEvent> { @Override public Optional<TaskCancelledEvent> from(ActivitiEntityEvent internalEvent) { TaskCancelledEvent event = null; if (isTaskCancelled(internalEvent)) { TaskEntity taskEntity = (TaskEntity) internalEvent.getEntity(); Task task = taskConverter.from(taskEntity, Task.TaskStatus.CANCELLED); String reason = internalEvent.getReason(); event = new TaskCancelledImpl(task, reason); } return Optional.ofNullable(event); } ToTaskCancelledConverter(APITaskConverter taskConverter); @Override Optional<TaskCancelledEvent> from(ActivitiEntityEvent internalEvent);  }