@Test(expected = RuntimeException.class) public void test_calling_create_And_Change_To_Directory_when_not_connected() throws IOException { Mockery mockContext = constructMockContext(); final FTPClient mockedFtpClient = mockContext.mock(FTPClient.class); final FtpClientFactory mockedFactory = mockContext.mock(FtpClientFactory.class); mockContext.checking(new Expectations() { { one(mockedFactory).createInstance(); will(returnValue(mockedFtpClient)); } }); FtpFileMover ftpFileMover = new FtpFileMover(mockedFactory); ftpFileMover.createAndChangeToDirectory("directory"); mockContext.assertIsSatisfied(); }
public void createAndChangeToDirectory(String depositDirectory) throws IOException { checkConnectedToServer(); ftpClient.makeDirectory(depositDirectory); changeToDirectory(depositDirectory); }
FtpFileMover implements FileMoverStrategy { public void createAndChangeToDirectory(String depositDirectory) throws IOException { checkConnectedToServer(); ftpClient.makeDirectory(depositDirectory); changeToDirectory(depositDirectory); } }
FtpFileMover implements FileMoverStrategy { public void createAndChangeToDirectory(String depositDirectory) throws IOException { checkConnectedToServer(); ftpClient.makeDirectory(depositDirectory); changeToDirectory(depositDirectory); } @Inject  FtpFileMover(FtpClientFactory ftpClientFactory); }
FtpFileMover implements FileMoverStrategy { public void createAndChangeToDirectory(String depositDirectory) throws IOException { checkConnectedToServer(); ftpClient.makeDirectory(depositDirectory); changeToDirectory(depositDirectory); } @Inject  FtpFileMover(FtpClientFactory ftpClientFactory); void connect(WctDepositParameter depositParameter); void createAndChangeToDirectory(String depositDirectory); void changeToDirectory(String depositDirectory); void storeFile(String fileName, InputStream stream); void close(); }
FtpFileMover implements FileMoverStrategy { public void createAndChangeToDirectory(String depositDirectory) throws IOException { checkConnectedToServer(); ftpClient.makeDirectory(depositDirectory); changeToDirectory(depositDirectory); } @Inject  FtpFileMover(FtpClientFactory ftpClientFactory); void connect(WctDepositParameter depositParameter); void createAndChangeToDirectory(String depositDirectory); void changeToDirectory(String depositDirectory); void storeFile(String fileName, InputStream stream); void close();  }