Test fixes

This commit is contained in:
David Solin
2016-08-24 08:35:08 -05:00
parent 79c1ae2bb0
commit 3f29879eca
2 changed files with 6 additions and 1 deletions

View File

@@ -15,6 +15,7 @@
*/
package net.schmizz.sshj.sftp;
import net.schmizz.sshj.common.LoggerFactory;
import net.schmizz.sshj.common.SSHException;
import net.schmizz.sshj.connection.channel.direct.Session.Subsystem;
import org.junit.Before;
@@ -43,6 +44,7 @@ public class PacketReaderTest {
engine = Mockito.mock(SFTPEngine.class);
subsystem = Mockito.mock(Subsystem.class);
Mockito.when(engine.getLoggerFactory()).thenReturn(LoggerFactory.DEFAULT);
Mockito.when(engine.getSubsystem()).thenReturn(subsystem);
Mockito.when(subsystem.getInputStream()).thenReturn(pipedin);

View File

@@ -20,12 +20,13 @@ import org.junit.Test;
import java.io.IOException;
import net.schmizz.sshj.common.LoggerFactory;
import static net.schmizz.sshj.sftp.PathHelper.DEFAULT_PATH_SEPARATOR;
import static org.mockito.Mockito.*;
public class SFTPClientTest {
private final SFTPEngine sftpEngine = mock(SFTPEngine.class);
private final SFTPClient client = new SFTPClient(sftpEngine);
@Before
public void setPathHelper() throws Exception {
@@ -39,6 +40,7 @@ public class SFTPClientTest {
}
}, DEFAULT_PATH_SEPARATOR);
when(sftpEngine.getPathHelper()).thenReturn(helper);
when(sftpEngine.getLoggerFactory()).thenReturn(LoggerFactory.DEFAULT);
}
@Before
@@ -49,6 +51,7 @@ public class SFTPClientTest {
@Test
public void doesNotTryToCreateDirectoryTwiceWhenPathHasTrailingSeparator() throws Exception {
SFTPClient client = new SFTPClient(sftpEngine);
client.mkdirs("/folder/directory/");
verify(sftpEngine, times(1)).makeDir("/folder/directory");
}