public void validate(WorkflowCreateRequest request, User caller) {
    LOG.debug(
        "validating workflow [{}] for user [{}]", request.getWorkflow().getId(), caller.getName());
    List<String> errors = new ArrayList<>();
    if (request.getWorkflow() == null) {
      errors.add("workflow cannot be null");
    }
    // definition data will be checked by dryRunValidator
    try {
      dryRunValidator.validate(request.getWorkflow(), caller);
    } catch (MaestroDryRunException e) {
      errors.add(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
    }
    if (!errors.isEmpty()) {
      throw new MaestroBadRequestException(errors, "Invalid workflow create request");
    }
  }
@Test
  public void testWorkflowValidate() {
    WorkflowCreateRequest request = new WorkflowCreateRequest();
    request.setWorkflow(definition.getWorkflow());
    actionHandler.validate(request, tester);
    verify(dryRunValidator, times(1)).validate(any(), any());
    verify(workflowDao, times(0)).addWorkflowDefinition(any(), any());
  }