1 package org.apache.maven.scm.provider.git.gitexe.command.add;
2
3 import java.io.File;
4 import java.util.ArrayList;
5 import java.util.List;
6
7 import org.apache.maven.scm.ScmTestCase;
8 import org.codehaus.plexus.util.cli.Commandline;
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 public class GitExeAddCommandTest
36 extends ScmTestCase
37 {
38
39 public void testAddCommandSingleFile() throws Exception
40 {
41 List<File> files = new ArrayList<File>();
42
43 files.add( new File( "myFile.java" ) );
44
45 testCommandLine( "scm:git:http://foo.com/git", files, "git add -- myFile.java" );
46 }
47
48 public void testAddCommandMultipleFiles() throws Exception
49 {
50 List<File> files = new ArrayList<File>();
51
52 files.add( new File( "myFile.java" ) );
53 files.add( new File( "myFile2.java" ) );
54 files.add( new File( "myFile3.java" ) );
55
56 testCommandLine( "scm:git:http://foo.com/git", files, "git add -- myFile.java myFile2.java myFile3.java" );
57 }
58
59
60
61
62
63 private void testCommandLine( String scmUrl, List<File> files, String commandLine )
64 throws Exception
65 {
66 File workingDirectory = getTestFile( "target/git-add-command-test" );
67
68 Commandline cl = GitAddCommand.createCommandLine(workingDirectory, files );
69
70 assertCommandLine( commandLine, workingDirectory, cl );
71 }
72
73 }