@Test
public void testCheckingOutFileFromAnotherBranch() throws JavaGitException, IOException {

    // Create a testBranch01 from master
    GitCheckoutOptions options = new GitCheckoutOptions();
    Ref branch1 = Ref.createBranchRef("testBranch01");
    options.setOptB(branch1);
    Ref branch = Ref.createBranchRef("master");
    gitCheckout.checkout(repositoryDirectory, options, branch);
    //File file3 = FileUtilities.createFile(repositoryDirectory, "foobar03", "New file foobar03");
    File file3 = new File(repositoryDirectory.getPath() + File.separator + "foobar03");
    file3.createNewFile();
    // add a file to testBranch01
    gitAdd.add(repositoryDirectory, null, new File("foobar03"));
    gitCommit.commit(repositoryDirectory, "Added foobar03 to the repository");
    assertFileExistsInDirectory(repositoryDirectory, new File("foobar03"));
    Ref master = Ref.createBranchRef("master");
    options = new GitCheckoutOptions();
    // Switch to new branch - testBranch02, base branch as master
    Ref newBranch = Ref.createBranchRef("testBranch02");
    options.setOptB(newBranch);
    gitCheckout.checkout(repositoryDirectory, options, master);
    // foobar03 does not exist in testBranch02 as it was created from master branch
    assertFalse(file3.exists());
    // checking out foobar03 file from branch - testBranch01
    gitCheckout.checkout(repositoryDirectory, null, branch1, file3);
    assertFileExistsInDirectory(repositoryDirectory, new File("foobar03"));
}