GitMv { public GitMvResponse mv(File repositoryPath, File source, File destination) throws IOException, JavaGitException { CheckUtilities.checkNullArgument(repositoryPath, "repository path"); CheckUtilities.checkNullArgument(source, "source"); CheckUtilities.checkNullArgument(destination, "destination"); IClient client = ClientManager.getInstance().getPreferredClient(); IGitMv gitMv = client.getGitMvInstance(); return gitMv.mv(repositoryPath, source, destination); }  GitMvResponse mv(File repositoryPath, File source, File destination); GitMvResponse mv(File repositoryPath, GitMvOptions options, File source,
      File destination); GitMvResponse mv(File repositoryPath, List<File> sources, File destination); GitMvResponse mv(File repositoryPath, GitMvOptions options, List<File> sources,
      File destination);  }
@Test public void testRename() throws IOException, JavaGitException { destination = new File("fileB.txt"); mv.mv(repoDirectory, source, destination); }
@Test public void testMove() throws IOException, JavaGitException { subDirOne = new File(repoDirectory.getPath() + File.separator + "subDirOne"); subDirOne.mkdir(); subDirOne = new File(subDirOne.getName()); fileOne = FileUtilities.createFile(repoDirectory, "fileOne", "Testfile#1"); fileTwo = FileUtilities.createFile(repoDirectory, "fileTwo", "Testfile#2"); fileThree = FileUtilities.createFile(repoDirectory, "fileThree", "Testfile#3"); List<File> filesToAdd = new ArrayList<File>(); filesToAdd.add(fileOne); filesToAdd.add(fileTwo); filesToAdd.add(fileThree); filesToAdd.add(subDirOne); add.add(repoDirectory, null, filesToAdd); commit.commit(repoDirectory, "Making the commit"); List<File> filesToMove = new ArrayList<File>(); filesToMove.add(fileOne); filesToMove.add(fileTwo); filesToMove.add(fileThree); destination = subDirOne; mv.mv(repoDirectory, filesToMove, destination); }
@Test public void testGitMvInvalidInput() throws IOException, JavaGitException { File source = new File("oldFile"); File destination = new File("newFile"); GitMv gitMv = new GitMv(); try { gitMv.mv(null, source, destination); } catch (Exception e) { assertEquals("Should have null pointer exception or illegal argument exception", ExceptionMessageMap.getMessage("000003") + " { variableName=[repository path] }", e .getMessage()); } List<File> fileList = new ArrayList<File>(); try { gitMv.mv(repoDirectory, fileList, destination); } catch (Exception e) { assertEquals("Should have null pointer exception or illegal argument exception", ExceptionMessageMap.getMessage("000005") + " { variableName=[sources] }", e.getMessage()); } try { gitMv.mv(repoDirectory, null, fileList, destination); } catch (Exception e) { assertEquals("Should have null pointer exception or illegal argument exception", ExceptionMessageMap.getMessage("000003") + " { variableName=[options] }", e.getMessage()); } try { gitMv.mv(repoDirectory, source, null); } catch (Exception e) { assertEquals("Should have null pointer exception or illegal argument exception", ExceptionMessageMap.getMessage("000003") + " { variableName=[destination] }", e .getMessage()); } try { gitMv.mv(repoDirectory, null, source, destination); } catch (Exception e) { assertEquals("Should have null pointer exception or illegal argument exception", ExceptionMessageMap.getMessage("000003") + " { variableName=[options] }", e.getMessage()); } }