@Test public void IsAvailable_WhenFTPS_ProtocolRequired(){ PreferenceHelper pm = mock(PreferenceHelper.class); when(pm.getFtpServerName()).thenReturn("example.com"); when(pm.getFtpPort()).thenReturn(9001); when(pm.shouldFtpUseFtps()).thenReturn(true); FtpManager aem = new FtpManager(pm); assertThat("If FTPS specified, a protocol is required", aem.isAvailable(), is(false)); when(pm.getFtpProtocol()).thenReturn("TLS"); assertThat("If FTPS specified, a protocol is required", aem.isAvailable(), is(true)); }
@Override public boolean isAvailable() { return validSettings(preferenceHelper.getFtpServerName(), preferenceHelper.getFtpUsername(), preferenceHelper.getFtpPassword(), preferenceHelper.getFtpPort(), preferenceHelper.shouldFtpUseFtps(), preferenceHelper.getFtpProtocol(), preferenceHelper.isFtpImplicit()); }
FtpManager extends FileSender { @Override public boolean isAvailable() { return validSettings(preferenceHelper.getFtpServerName(), preferenceHelper.getFtpUsername(), preferenceHelper.getFtpPassword(), preferenceHelper.getFtpPort(), preferenceHelper.shouldFtpUseFtps(), preferenceHelper.getFtpProtocol(), preferenceHelper.isFtpImplicit()); } }
FtpManager extends FileSender { @Override public boolean isAvailable() { return validSettings(preferenceHelper.getFtpServerName(), preferenceHelper.getFtpUsername(), preferenceHelper.getFtpPassword(), preferenceHelper.getFtpPort(), preferenceHelper.shouldFtpUseFtps(), preferenceHelper.getFtpProtocol(), preferenceHelper.isFtpImplicit()); } FtpManager(PreferenceHelper preferenceHelper); }
FtpManager extends FileSender { @Override public boolean isAvailable() { return validSettings(preferenceHelper.getFtpServerName(), preferenceHelper.getFtpUsername(), preferenceHelper.getFtpPassword(), preferenceHelper.getFtpPort(), preferenceHelper.shouldFtpUseFtps(), preferenceHelper.getFtpProtocol(), preferenceHelper.isFtpImplicit()); } FtpManager(PreferenceHelper preferenceHelper); void testFtp(final String servername, final String username, final String password, final String directory, final int port, final boolean useFtps, final String protocol, final boolean implicit); @Override void uploadFile(List<File> files); @Override boolean isAvailable(); @Override boolean hasUserAllowedAutoSending(); void uploadFile(final File f); @Override boolean accept(File file, String s); boolean validSettings(String servername, String username, String password, Integer port, boolean useFtps,
                                 String sslTls, boolean implicit); }
FtpManager extends FileSender { @Override public boolean isAvailable() { return validSettings(preferenceHelper.getFtpServerName(), preferenceHelper.getFtpUsername(), preferenceHelper.getFtpPassword(), preferenceHelper.getFtpPort(), preferenceHelper.shouldFtpUseFtps(), preferenceHelper.getFtpProtocol(), preferenceHelper.isFtpImplicit()); } FtpManager(PreferenceHelper preferenceHelper); void testFtp(final String servername, final String username, final String password, final String directory, final int port, final boolean useFtps, final String protocol, final boolean implicit); @Override void uploadFile(List<File> files); @Override boolean isAvailable(); @Override boolean hasUserAllowedAutoSending(); void uploadFile(final File f); @Override boolean accept(File file, String s); boolean validSettings(String servername, String username, String password, Integer port, boolean useFtps,
                                 String sslTls, boolean implicit);  }