Object getFromInstance(String fieldName) {
    try {
      Object ret =
          executor
              .submit(() -> fromInstance(fieldName))
              .get(TIMEOUT_IN_MILLIS, TimeUnit.MILLISECONDS);
      // As param does not allow null, using empty space indicates unset for now.
      return ret == null ? "" : ret;
    } catch (Exception e) {
      throw new MaestroInternalError(
          e, "getFromInstance throws an exception for fieldName=[%s]", fieldName);
    }
  }
@Test
  public void testGetFromInstance() {
    when(instanceWrapper.getWorkflowId()).thenReturn("test-workflow-id");
    when(instanceWrapper.getWorkflowInstanceId()).thenReturn(2L);
    when(instanceWrapper.isWorkflowParam()).thenReturn(true);
    when(instanceWrapper.getInitiatorTimeZone()).thenReturn("US/Pacific");
    Initiator initiator = new ManualInitiator();
    initiator.setCaller(User.create("tester"));
    when(instanceWrapper.getInitiator()).thenReturn(initiator);
    when(instanceWrapper.getRunPolicy()).thenReturn("START_FRESH_NEW_RUN");
    when(instanceWrapper.getWorkflowOwner()).thenReturn("tester");
    when(instanceWrapper.getFirstTimeTriggerTimeZone()).thenReturn("UTC");
    assertEquals("US/Pacific", paramExtension.getFromInstance(Constants.INITIATOR_TIMEZONE_PARAM));
    assertEquals("MANUAL", paramExtension.getFromInstance(Constants.INITIATOR_TYPE_PARAM));
    assertEquals("tester", paramExtension.getFromInstance(Constants.INITIATOR_RUNNER_NAME));
    assertEquals(
        "START_FRESH_NEW_RUN", paramExtension.getFromInstance(Constants.WORKFLOW_RUN_POLICY_PARAM));
    assertEquals("tester", paramExtension.getFromInstance(Constants.WORKFLOW_OWNER_PARAM));
    assertEquals(
        "UTC", paramExtension.getFromInstance(Constants.FIRST_TIME_TRIGGER_TIMEZONE_PARAM));
    assertEquals("test-workflow-id", paramExtension.getFromInstance(Constants.WORKFLOW_ID_PARAM));
    assertEquals(2L, paramExtension.getFromInstance(Constants.WORKFLOW_INSTANCE_ID_PARAM));
    initiator = new DryRunValidator.ValidationInitiator();
    when(instanceWrapper.getInitiator()).thenReturn(initiator);
    assertEquals("VALIDATION", paramExtension.getFromInstance(Constants.INITIATOR_TYPE_PARAM));
  }