# Path: artman/tasks/format_tasks.py
# class JavaFormatTask(task_base.TaskBase):
# class GoFormatTask(task_base.TaskBase):
# class PhpFormatTask(task_base.TaskBase):
#     def execute(self, gapic_code_dir, toolkit_path):
#     def validate(self):
#     def execute(self, gapic_code_dir):
#     def execute(self, gapic_code_dir):
# def get_format_task(language):
# _FORMAT_TASK_DICT = {
#     'java': JavaFormatTask,
#     'go': GoFormatTask,
#     'php': PhpFormatTask,
# }
# 
# Path: artman/utils/task_utils.py
# def get_java_tool_path(toolkit_path, tool_name):
# def gapic_gen_task(toolkit_path, task_args):
# def run_gradle_task(toolkit_path, task_name, task_args=()):
# def api_full_name(api_name, api_version, organization_name):
# def is_output_gcloud(language, gapic_code_dir):
# def instantiate_tasks(task_class_list, inject):


import os
import unittest
import subprocess
import mock
import pytest
from artman.tasks import format_tasks
from artman.utils import task_utils
    @mock.patch.object(format_tasks.JavaFormatTask, 'exec_command')
    @mock.patch.object(task_utils, 'get_java_tool_path')
    @mock.patch.object(os, 'walk')
    def test_execute(self, walk, gradle_output, exec_command):
        gradle_output.return_value = '/path/to/gapic'
        walk.return_value = (['/path', (), ('f1.java', 'f2.java', 'f3.py')],)
        task = format_tasks.JavaFormatTask()
        task.execute('/path/to/gapic', '/path/to/toolkit')
        exec_command.assert_called_once_with([
            'java', '-jar', '/path/to/gapic', '--replace',
            '/path/f1.java', '/path/f2.java',
        ])

    def test_validate(self):
        task = format_tasks.JavaFormatTask()
        assert task.validate() == []


class GoFormatTaskTests(unittest.TestCase):
    @mock.patch.object(format_tasks.GoFormatTask, 'exec_command')
    def test_execute(self, exec_command):
        task = format_tasks.GoFormatTask()
        task.execute('/path/to/gapic')
        exec_command.assert_called_once_with(['gofmt', '-w', '/path/to/gapic'])


class PhpFormatTaskTests(unittest.TestCase):
    @mock.patch.object(subprocess, 'call')
    def test_execute(self, call):
        call.return_value = 0

# Path: artman/tasks/format_tasks.py
# class JavaFormatTask(task_base.TaskBase):
# class GoFormatTask(task_base.TaskBase):
# class PhpFormatTask(task_base.TaskBase):
#     def execute(self, gapic_code_dir, toolkit_path):
#     def validate(self):
#     def execute(self, gapic_code_dir):
#     def execute(self, gapic_code_dir):
# def get_format_task(language):
# _FORMAT_TASK_DICT = {
#     'java': JavaFormatTask,
#     'go': GoFormatTask,
#     'php': PhpFormatTask,
# }
# 
# Path: artman/utils/task_utils.py
# def get_java_tool_path(toolkit_path, tool_name):
# def gapic_gen_task(toolkit_path, task_args):
# def run_gradle_task(toolkit_path, task_name, task_args=()):
# def api_full_name(api_name, api_version, organization_name):
# def is_output_gcloud(language, gapic_code_dir):
# def instantiate_tasks(task_class_list, inject):


# Path: test/tasks/test_format.py
import os
import unittest
import subprocess
import mock
import pytest
from artman.tasks import format_tasks
from artman.utils import task_utils

    @mock.patch.object(format_tasks.JavaFormatTask, 'exec_command')
    @mock.patch.object(task_utils, 'get_java_tool_path')
    @mock.patch.object(os, 'walk')
    def test_execute(self, walk, gradle_output, exec_command):
        gradle_output.return_value = '/path/to/gapic'
        walk.return_value = (['/path', (), ('f1.java', 'f2.java', 'f3.py')],)
        task = format_tasks.JavaFormatTask()
        task.execute('/path/to/gapic', '/path/to/toolkit')
        exec_command.assert_called_once_with([
            'java', '-jar', '/path/to/gapic', '--replace',
            '/path/f1.java', '/path/f2.java',
        ])

    def test_validate(self):
        task = format_tasks.JavaFormatTask()
        assert task.validate() == []


class GoFormatTaskTests(unittest.TestCase):
    @mock.patch.object(format_tasks.GoFormatTask, 'exec_command')
    def test_execute(self, exec_command):
        task = format_tasks.GoFormatTask()
        task.execute('/path/to/gapic')
        exec_command.assert_called_once_with(['gofmt', '-w', '/path/to/gapic'])


class PhpFormatTaskTests(unittest.TestCase):
    @mock.patch.object(subprocess, 'call')
    def test_execute(self, call):
        call.return_value = 0

        task = format_tasks.PhpFormatTask()