func Test_RunJob_NoCommand(t *testing.T) {
	jobDef := scoot.NewJobDefinition()
	task := testhelpers.GenTask(testhelpers.NewRand(), "1", "")
	task.Command.Argv = []string{}
	jobDef.Tasks = []*scoot.TaskDefinition{task}
	jobId, err := RunJob(CreateSchedulerMock(t), jobDef, stats.NilStatsReceiver())
	if !IsInvalidJobRequest(err) {
		t.Errorf("expected error to be InvalidJobRequest not %v", reflect.TypeOf(err))
	}
	if jobId != nil {
		t.Errorf("expected job Id to be nil when error occurs not %v", jobId)
	}
}
Jobs with Tasks with no commands should return InvalidJobRequest error
package thrift
import (
	"errors"
	"reflect"
	"testing"
	"github.com/golang/mock/gomock"
	"github.com/twitter/scoot/common/stats"
	"github.com/twitter/scoot/scheduler/api/thrift/gen-go/scoot"
	"github.com/twitter/scoot/scheduler/server"
	"github.com/twitter/scoot/tests/testhelpers"
)
func IsInvalidJobRequest(err error) bool {
	switch err.(type) {
	case *InvalidJobRequest:
		return true
	default:
		return false
	}
}
func CreateSchedulerMock(t *testing.T) *server.MockScheduler {
	mockCtrl := gomock.NewController(t)
	defer mockCtrl.Finish()
	scheduler := server.NewMockScheduler(mockCtrl)
	return scheduler
}
func Test_RunJob_WithNoTasks(t *testing.T) {
	jobDef := scoot.NewJobDefinition()
	jobId, err := RunJob(CreateSchedulerMock(t), jobDef, stats.NilStatsReceiver())
	if err == nil {
		t.Errorf("expected error running Job with no command")
	}
	if !IsInvalidJobRequest(err) {
		t.Errorf("expected error to be InvalidJobRequest not %v", reflect.TypeOf(err))
	}
	if jobId != nil {
		t.Errorf("expected job Id to be nil when error occurs not %v", jobId)
	}
}
func Test_RunJob_InvalidTaskId(t *testing.T) {
	jobDef := scoot.NewJobDefinition()
	task := testhelpers.GenTask(testhelpers.NewRand(), "", "")
	jobDef.Tasks = []*scoot.TaskDefinition{task}
	jobId, err := RunJob(CreateSchedulerMock(t), jobDef, stats.NilStatsReceiver())
	if !IsInvalidJobRequest(err) {
		t.Errorf("expected error to be InvalidJobRequest not %v", reflect.TypeOf(err))
	}
	if jobId != nil {
		t.Errorf("expected job Id to be nil when error occurs not %v", jobId)
	}
}