PGETaskInstance implements WorkflowTaskInstance { protected String getWorkflowInstanceId() { String instanceId = pgeMetadata.getMetadata(CoreMetKeys.WORKFLOW_INST_ID); logger.debug("Workflow instanceId is [{}]", instanceId); Validate.notNull(instanceId, "Must specify " + CoreMetKeys.WORKFLOW_INST_ID); return instanceId; } protected  PGETaskInstance(); @Override void run(Metadata metadata, WorkflowTaskConfiguration config); String getWorkflowInstId(); void setWorkflowInstId(String workflowInstId); void setWmClient(WorkflowManagerClient wmClient); @Override void finalize();  }
@Test public void testGetWorkflowInstanceId() throws Exception { String workflowInstId = "12345"; PGETaskInstance pgeTask = createTestInstance(); pgeTask.pgeMetadata.replaceMetadata(CoreMetKeys.WORKFLOW_INST_ID, workflowInstId); assertEquals(workflowInstId, pgeTask.getWorkflowInstanceId()); }