MetadataMapperService { @VisibleForTesting boolean shouldPopulateTaskDefinition(WorkflowTask workflowTask) { Preconditions.checkNotNull(workflowTask, "WorkflowTask cannot be null"); Preconditions.checkNotNull(workflowTask.getType(), "WorkflowTask type cannot be null"); return workflowTask.getTaskDefinition() == null && StringUtils.isNotBlank(workflowTask.getName()); } @Inject  MetadataMapperService(MetadataDAO metadataDAO); WorkflowDef lookupForWorkflowDefinition(String name, Integer version); Workflow populateWorkflowWithDefinitions(Workflow workflow); WorkflowDef populateTaskDefinitions(WorkflowDef workflowDefinition); Task populateTaskWithDefinition(Task task); static final Logger logger; }
@Test public void testShouldNotPopulateTaskDefinition() { WorkflowTask workflowTask = createWorkflowTask(""); assertFalse(metadataMapperService.shouldPopulateTaskDefinition(workflowTask)); }
@Test public void testShouldPopulateTaskDefinition() { WorkflowTask workflowTask = createWorkflowTask("test"); assertTrue(metadataMapperService.shouldPopulateTaskDefinition(workflowTask)); }