@@ -298,25 +298,11 @@ func (env *testWorkflowEnvironmentImpl) setActivityTaskList(tasklist string, act
298298}
299299
300300func (env * testWorkflowEnvironmentImpl ) executeWorkflow (workflowFn interface {}, args ... interface {}) {
301- var workflowType string
302- fnType := reflect .TypeOf (workflowFn )
303- switch fnType .Kind () {
304- case reflect .String :
305- workflowType = workflowFn .(string )
306- case reflect .Func :
307- workflowType = getFunctionName (workflowFn )
308- if alias , ok := getHostEnvironment ().getWorkflowAlias (workflowType ); ok {
309- workflowType = alias
310- }
311- default :
312- panic ("unsupported workflowFn" )
313- }
314-
315- input , err := getHostEnvironment ().encodeArgs (args )
301+ workflowType , input , err := getValidatedWorkflowFunction (workflowFn , args )
316302 if err != nil {
317303 panic (err )
318304 }
319- env .executeWorkflowInternal (workflowType , input )
305+ env .executeWorkflowInternal (workflowType . Name , input )
320306}
321307
322308func (env * testWorkflowEnvironmentImpl ) executeWorkflowInternal (workflowType string , input []byte ) {
@@ -353,15 +339,13 @@ func (env *testWorkflowEnvironmentImpl) executeActivity(
353339 activityFn interface {},
354340 args ... interface {},
355341) (encoded.Value , error ) {
356- fnName := getFunctionName (activityFn )
357-
358- input , err := getHostEnvironment ().encodeArgs (args )
342+ activityType , input , err := getValidatedActivityFunction (activityFn , args )
359343 if err != nil {
360344 panic (err )
361345 }
362346
363347 params := executeActivityParameters {
364- ActivityType : ActivityType { Name : fnName } ,
348+ ActivityType : * activityType ,
365349 Input : input ,
366350 ScheduleToCloseTimeoutSeconds : 600 ,
367351 StartToCloseTimeoutSeconds : 600 ,
0 commit comments