RemoteResourceManager { public void uploadResources() { for(Resource resource : managedResources) { try { uploadResource(resource); } catch (IOException ex) { logger.warn("Failed to upload {} to ssh: new Object[]{resource.getName(), sshClient.getHost(), sshClient.getPort(), remoteResourcesDir, ex}); } catch (SSHClientException ex) { logger.warn("Failed to upload {} to ssh: new Object[]{resource.getName(), sshClient.getHost(), sshClient.getPort(), remoteResourcesDir, ex}); } } } RemoteResourceManager(SSHClient sshClient, String remoteResourcesDirPath, 
            String remoteResourcesDirName, String remoteSeparator);  RemoteResourceManager(SSHClient sshClient); void addResource(Resource resource); void removeResource(Resource resource); void uploadResources(); void deployResources(); void prepareResourceDirectory(); String getRemoteFile(Resource resource); static final String DEFAULT_REMOTE_RESOURCES_DIR_NAME; static final String DEFAULT_REMOTE_SEPARATOR; }
@Test public void testUploadResources() throws SSHClientException { resourceManager.addResource(dummyResource); resourceManager.addResource(dummyResource2); resourceManager.addResource(uploadedUndeployedResource); resourceManager.uploadResources(); verify(sshClient, times(4)).sftpUpload( Matchers.any(InputStream.class), anyString()); when(dummyResource.isUploaded()).thenReturn(Boolean.TRUE); when(dummyResource2.isUploaded()).thenReturn(Boolean.TRUE); when(uploadedUndeployedResource.isUploaded()).thenReturn(Boolean.TRUE); resourceManager.addResource(dummyResource3); resourceManager.uploadResources(); verify(sshClient, times(6)).sftpUpload( Matchers.any(InputStream.class), anyString()); }