// Path: javagit/src/test/java/edu/nyu/cs/javagit/TestBase.java
// @Ignore
// public class TestBase extends TestCase {
// 
//     @Before
//     public void setUp() throws IOException, JavaGitException {
//         JavaGitConfiguration.setGitPath(TestProperty.GIT_PATH.asString());
//     }
// }
// 
// Path: javagit/src/main/java/edu/nyu/cs/javagit/api/commands/GitAddResponse.java
// public abstract class GitAddResponse implements CommandResponse {
// 
//   /**
//    * List of files added to the index by &lt;git-add&gt; command.
//    */
//   protected List<File> filePathsList;
// 
//   /**
//    * Initially set to true as git-add many times does not generate any output at all. If output is
//    * generated then it needs to be set to false. This can be used as a tester whether any output was
//    * generated or not.
//    */
//   protected boolean noOutput;
// 
//   protected List<ResponseString> comments;
// 
//   protected boolean dryRun;
// 
//   /**
//    * Constructor
//    */
//   public GitAddResponse() {
//     filePathsList = new ArrayList<File>();
//     comments = new ArrayList<ResponseString>();
//     noOutput = true;
//     dryRun = false;
//   }
// 
//   /**
//    * Gets the number of files added.
//    * 
//    * @return size of list.
//    */
//   public int getFileListSize() {
//     return filePathsList.size();
//   }
// 
//   public File get(int index) throws IndexOutOfBoundsException {
//     if (index < filePathsList.size() && index >= 0) {
//       return filePathsList.get(index);
//     }
//     throw new IndexOutOfBoundsException(index + " is out of range");
//   }
// 
//   public boolean noOutput() {
//     return noOutput;
//   }
// 
//   public boolean dryRun() {
//     return dryRun;
//   }
// 
//   public boolean comment() {
//     return (comments.size() > 0);
//   }
// 
//   public int nubmerOfComments() {
//     return comments.size();
//   }
// 
//   public ResponseString getComment(int index) {
//     CheckUtilities.checkIntInRange(index, 0, comments.size());
//     return (comments.get(index));
//   }
// 
//   /**
//    * For saving errors, warnings and comments related information in the response object. Currently
//    * it has only two fields -
//    * <ul>
//    * <li>Error, warning or general comment string</li>
//    * <li>Line number where the string appeared in output</li>
//    * <ul>
//    */
//   public static class ResponseString {
//     final String comment;
//     final int lineNumber;
// 
//     public ResponseString(int lineNumber, String comment) {
//       this.lineNumber = lineNumber;
//       this.comment = comment;
//     }
// 
//     public int getLineNumber() {
//       return lineNumber;
//     }
// 
//     public String comment() {
//       return comment;
//     }
// 
//   }
// }


import edu.nyu.cs.javagit.TestBase;
import edu.nyu.cs.javagit.api.JavaGitException;
import edu.nyu.cs.javagit.api.commands.GitAddOptions;
import edu.nyu.cs.javagit.api.commands.GitAddResponse;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
     * <code>testGitAddNullRepositoryPath</code> where the repositoryPath is null.
     *
     * @throws IOException thrown if file paths or repository path provided is found or git command is not found.
     */
    @Test(expected = IOException.class)
    public void testGitAddIOExceptionThrown() throws IOException, JavaGitException {
        try {
            CliGitAdd gitAdd = new CliGitAdd();
            GitAddOptions options = null;
            List<File> fileNames = new ArrayList<File>();
            fileNames.add(new File("testFile"));
            gitAdd.add(new File("repo/path/should/not/exist"), options, fileNames);
        } catch (IOException e) {
            return;
        }
        fail("IOException not thrown");
    }

    /**
     * Test for parsing the a valid output generated after a couple of files are added to the
     * repository. The output starts with 'add'.
     */
    @Test
    public void testGitAddParserValidInput() throws JavaGitException {
        CliGitAdd.GitAddParser parser = new CliGitAdd.GitAddParser();
        parser.parseLine("add 'test-repository/eg9'");
        parser.parseLine("add 'test-repository/testdir/foo'");
        GitAddResponse response = parser.getResponse();
        assertEquals("No of lines in output does not match", 2, response.getFileListSize());
        assertEquals("File name does not match", "eg9", response.get(0).getName());
// Path: javagit/src/test/java/edu/nyu/cs/javagit/TestBase.java
// @Ignore
// public class TestBase extends TestCase {
// 
//     @Before
//     public void setUp() throws IOException, JavaGitException {
//         JavaGitConfiguration.setGitPath(TestProperty.GIT_PATH.asString());
//     }
// }
// 
// Path: javagit/src/main/java/edu/nyu/cs/javagit/api/commands/GitAddResponse.java
// public abstract class GitAddResponse implements CommandResponse {
// 
//   /**
//    * List of files added to the index by &lt;git-add&gt; command.
//    */
//   protected List<File> filePathsList;
// 
//   /**
//    * Initially set to true as git-add many times does not generate any output at all. If output is
//    * generated then it needs to be set to false. This can be used as a tester whether any output was
//    * generated or not.
//    */
//   protected boolean noOutput;
// 
//   protected List<ResponseString> comments;
// 
//   protected boolean dryRun;
// 
//   /**
//    * Constructor
//    */
//   public GitAddResponse() {
//     filePathsList = new ArrayList<File>();
//     comments = new ArrayList<ResponseString>();
//     noOutput = true;
//     dryRun = false;
//   }
// 
//   /**
//    * Gets the number of files added.
//    * 
//    * @return size of list.
//    */
//   public int getFileListSize() {
//     return filePathsList.size();
//   }
// 
//   public File get(int index) throws IndexOutOfBoundsException {
//     if (index < filePathsList.size() && index >= 0) {
//       return filePathsList.get(index);
//     }
//     throw new IndexOutOfBoundsException(index + " is out of range");
//   }
// 
//   public boolean noOutput() {
//     return noOutput;
//   }
// 
//   public boolean dryRun() {
//     return dryRun;
//   }
// 
//   public boolean comment() {
//     return (comments.size() > 0);
//   }
// 
//   public int nubmerOfComments() {
//     return comments.size();
//   }
// 
//   public ResponseString getComment(int index) {
//     CheckUtilities.checkIntInRange(index, 0, comments.size());
//     return (comments.get(index));
//   }
// 
//   /**
//    * For saving errors, warnings and comments related information in the response object. Currently
//    * it has only two fields -
//    * <ul>
//    * <li>Error, warning or general comment string</li>
//    * <li>Line number where the string appeared in output</li>
//    * <ul>
//    */
//   public static class ResponseString {
//     final String comment;
//     final int lineNumber;
// 
//     public ResponseString(int lineNumber, String comment) {
//       this.lineNumber = lineNumber;
//       this.comment = comment;
//     }
// 
//     public int getLineNumber() {
//       return lineNumber;
//     }
// 
//     public String comment() {
//       return comment;
//     }
// 
//   }
// }


// Path: javagit/src/test/java/edu/nyu/cs/javagit/client/cli/TestCliGitAdd.java
import edu.nyu.cs.javagit.TestBase;
import edu.nyu.cs.javagit.api.JavaGitException;
import edu.nyu.cs.javagit.api.commands.GitAddOptions;
import edu.nyu.cs.javagit.api.commands.GitAddResponse;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

     * <code>testGitAddNullRepositoryPath</code> where the repositoryPath is null.
     *
     * @throws IOException thrown if file paths or repository path provided is found or git command is not found.
     */
    @Test(expected = IOException.class)
    public void testGitAddIOExceptionThrown() throws IOException, JavaGitException {
        try {
            CliGitAdd gitAdd = new CliGitAdd();
            GitAddOptions options = null;
            List<File> fileNames = new ArrayList<File>();
            fileNames.add(new File("testFile"));
            gitAdd.add(new File("repo/path/should/not/exist"), options, fileNames);
        } catch (IOException e) {
            return;
        }
        fail("IOException not thrown");
    }

    /**
     * Test for parsing the a valid output generated after a couple of files are added to the
     * repository. The output starts with 'add'.
     */
    @Test
    public void testGitAddParserValidInput() throws JavaGitException {
        CliGitAdd.GitAddParser parser = new CliGitAdd.GitAddParser();
        parser.parseLine("add 'test-repository/eg9'");
        parser.parseLine("add 'test-repository/testdir/foo'");
        GitAddResponse response = parser.getResponse();
        assertEquals("No of lines in output does not match", 2, response.getFileListSize());
        assertEquals("File name does not match", "eg9", response.get(0).getName());
        assertEquals("File path provided when adding does not match.", "test-repository"