}}).when(sftpProtocol).connect("localhost", new HostKeyAuthentication("bfoster", "",
pubKeyFile.getAbsoluteFile().getAbsolutePath()));
sftpProtocol.connect("localhost", new HostKeyAuthentication("bfoster", "",
pubKeyFile.getAbsoluteFile().getAbsolutePath()));
ProtocolFile homeDir = sftpProtocol.pwd();
ProtocolFile testDir = new ProtocolFile(homeDir, "sshTestDir", true);
sftpProtocol.cd(testDir);
Mockito.when(sftpProtocol.pwd()).thenReturn(new ProtocolFile(homeDir, "sshTestDir", true));
assertEquals(testDir, sftpProtocol.pwd());
List<ProtocolFile> lsResults = new ArrayList<ProtocolFile>(
sftpProtocol.ls(new ProtocolFileFilter() {
public boolean accept(ProtocolFile file) {
return file.getName().equals("sshTestFile");
}
}));
assertEquals(1, lsResults.size());
ProtocolFile testFile = lsResults.get(0);
ProtocolFile testnew = new ProtocolFile(testDir, "sshTestFile", false);
assertEquals(new ProtocolFile(null, testDir.getPath()+"/sshTestFile", false), testFile);
}