Simplify _validateTaskVariables
Update tests with ValidationError.