func (t *TestWorkflowEnvironment) OnGetVersion(changeID string, minSupported, maxSupported Version) *MockCallWrapper {
	call := t.Mock.On(getMockMethodForGetVersion(changeID), changeID, minSupported, maxSupported)
	return t.wrapCall(call)
}
OnGetVersion setup a mock for workflow.GetVersion() call. By default, if mock is not setup, the GetVersion call from
workflow code will always return the maxSupported version. Make it not possible to test old version branch. With this
mock support, it is possible to test code branch for different versions.

Note: mock can be setup for a specific changeID. Or if mock.Anything is used as changeID then all calls to GetVersion
will be mocked. Mock for a specific changeID has higher priority over mock.Anything.
package internal
import (
	"context"
	"fmt"
	"reflect"
	"time"
	"github.com/stretchr/testify/mock"
	"github.com/uber-go/tally"
	"go.uber.org/cadence/.gen/go/shared"
	"go.uber.org/zap"
)
type (
	EncodedValues struct {
		values        []byte
		dataConverter DataConverter
	}
	WorkflowTestSuite struct {
		logger   *zap.Logger
		scope    tally.Scope
		ctxProps []ContextPropagator
		header   *shared.Header
	}
	TestWorkflowEnvironment struct {
		mock.Mock
		impl *testWorkflowEnvironmentImpl
	}
	TestActivityEnvironment struct {
		impl *testWorkflowEnvironmentImpl
	}
	MockCallWrapper struct {
		call *mock.Call
		env  *TestWorkflowEnvironment
		runFn        func(args mock.Arguments)
		waitDuration func() time.Duration
	}
)
func newEncodedValues(values []byte, dc DataConverter) Values {
	if dc == nil {
		dc = getDefaultDataConverter()
	}
	return &EncodedValues{values, dc}
}
func (b EncodedValues) Get(valuePtr ...interface{}) error {
	if !b.HasValues() {
		return ErrNoData
	}
	return b.dataConverter.FromData(b.values, valuePtr...)
}
func (b EncodedValues) HasValues() bool {
	return b.values != nil
}
func (s *WorkflowTestSuite) NewTestWorkflowEnvironment() *TestWorkflowEnvironment {
	return &TestWorkflowEnvironment{impl: newTestWorkflowEnvironmentImpl(s, nil)}
}
func (s *WorkflowTestSuite) NewTestActivityEnvironment() *TestActivityEnvironment {
	return &TestActivityEnvironment{impl: newTestWorkflowEnvironmentImpl(s, nil)}
}
func (s *WorkflowTestSuite) SetLogger(logger *zap.Logger) {
	s.logger = logger
}
func (s *WorkflowTestSuite) GetLogger() *zap.Logger {
	return s.logger
}
func (s *WorkflowTestSuite) SetMetricsScope(scope tally.Scope) {
	s.scope = scope
}
func (s *WorkflowTestSuite) SetContextPropagators(ctxProps []ContextPropagator) {
	s.ctxProps = ctxProps
}
func (s *WorkflowTestSuite) SetHeader(header *shared.Header) {
	s.header = header
}
func (t *TestActivityEnvironment) RegisterActivity(a interface{}) {
	t.impl.RegisterActivity(a)
}
func (t *TestActivityEnvironment) RegisterActivityWithOptions(a interface{}, options RegisterActivityOptions) {
	t.impl.RegisterActivityWithOptions(a, options)
}
func (t *TestActivityEnvironment) ExecuteActivity(activityFn interface{}, args ...interface{}) (Value, error) {
	return t.impl.executeActivity(activityFn, args...)
}
func (t *TestActivityEnvironment) ExecuteLocalActivity(activityFn interface{}, args ...interface{}) (val Value, err error) {
	return t.impl.executeLocalActivity(activityFn, args...)
}
func (t *TestActivityEnvironment) SetWorkerOptions(options WorkerOptions) *TestActivityEnvironment {
	t.impl.setWorkerOptions(options)
	return t
}
func (t *TestActivityEnvironment) SetTestTimeout(idleTimeout time.Duration) *TestActivityEnvironment {
	t.impl.testTimeout = idleTimeout
	return t
}
func (t *TestActivityEnvironment) SetHeartbeatDetails(details interface{}) {
	t.impl.setHeartbeatDetails(details)
}
func (t *TestActivityEnvironment) SetWorkerStopChannel(c chan struct{}) {
	t.impl.setWorkerStopChannel(c)
}
func (t *TestWorkflowEnvironment) RegisterWorkflow(w interface{}) {
	t.impl.RegisterWorkflow(w)
}
func (t *TestWorkflowEnvironment) RegisterWorkflowWithOptions(w interface{}, options RegisterWorkflowOptions) {
	if len(t.ExpectedCalls) > 0 {
		panic("RegisterWorkflow calls cannot follow mock related ones like OnWorkflow or similar")
	}
	t.impl.RegisterWorkflowWithOptions(w, options)
}
func (t *TestWorkflowEnvironment) RegisterActivity(a interface{}) {
	t.impl.RegisterActivity(a)
}
func (t *TestWorkflowEnvironment) RegisterActivityWithOptions(a interface{}, options RegisterActivityOptions) {
	if len(t.ExpectedCalls) > 0 {
		panic("RegisterActivity calls cannot follow mock related ones like OnActivity or similar")
	}
	t.impl.RegisterActivityWithOptions(a, options)
}
func (t *TestWorkflowEnvironment) SetStartTime(startTime time.Time) {
	t.impl.setStartTime(startTime)
}
func (t *TestWorkflowEnvironment) OnActivity(activity interface{}, args ...interface{}) *MockCallWrapper {
	fType := reflect.TypeOf(activity)
	var call *mock.Call
	switch fType.Kind() {
	case reflect.Func:
		fnType := reflect.TypeOf(activity)
		if err := validateFnFormat(fnType, false); err != nil {
			panic(err)
		}
		fnName := getActivityFunctionName(t.impl.registry, activity)
		call = t.Mock.On(fnName, args...)
	case reflect.String:
		call = t.Mock.On(activity.(string), args...)
	default:
		panic("activity must be function or string")
	}
	return t.wrapCall(call)
}
var ErrMockStartChildWorkflowFailed = fmt.Errorf("start child workflow failed: %v", shared.ChildWorkflowExecutionFailedCauseWorkflowAlreadyRunning)
func (t *TestWorkflowEnvironment) OnWorkflow(workflow interface{}, args ...interface{}) *MockCallWrapper {
	fType := reflect.TypeOf(workflow)
	var call *mock.Call
	switch fType.Kind() {
	case reflect.Func:
		fnType := reflect.TypeOf(workflow)
		if err := validateFnFormat(fnType, true); err != nil {
			panic(err)
		}
		fnName := getWorkflowFunctionName(t.impl.registry, workflow)
		if alias, ok := t.impl.registry.getWorkflowAlias(fnName); ok {
			fnName = alias
		}
		call = t.Mock.On(fnName, args...)
	case reflect.String:
		call = t.Mock.On(workflow.(string), args...)
	default:
		panic("activity must be function or string")
	}
	return t.wrapCall(call)
}
const mockMethodForSignalExternalWorkflow = "workflow.SignalExternalWorkflow"
const mockMethodForRequestCancelExternalWorkflow = "workflow.RequestCancelExternalWorkflow"
const mockMethodForGetVersion = "workflow.GetVersion"
const mockMethodForUpsertSearchAttributes = "workflow.UpsertSearchAttributes"
func (t *TestWorkflowEnvironment) OnSignalExternalWorkflow(domainName, workflowID, runID, signalName, arg interface{}) *MockCallWrapper {
	call := t.Mock.On(mockMethodForSignalExternalWorkflow, domainName, workflowID, runID, signalName, arg)
	return t.wrapCall(call)
}
func (t *TestWorkflowEnvironment) OnRequestCancelExternalWorkflow(domainName, workflowID, runID string) *MockCallWrapper {
	call := t.Mock.On(mockMethodForRequestCancelExternalWorkflow, domainName, workflowID, runID)
	return t.wrapCall(call)
}