@Test public void IsAvailable_WithValidValues_IsAvailable(){ PreferenceHelper pm = mock(PreferenceHelper.class); OwnCloudManager ocm = new OwnCloudManager(pm); assertThat("Default state is false", ocm.isAvailable(), is(false)); when(pm.getOwnCloudServerName()).thenReturn(""); assertThat("Server name should not be empty", ocm.isAvailable(), is(false)); when(pm.getOwnCloudServerName()).thenReturn("sadfasdf"); assertThat("Server name should not be empty", ocm.isAvailable(), is(true)); }
@Override public boolean isAvailable() { return validSettings(preferenceHelper.getOwnCloudServerName(), preferenceHelper.getOwnCloudUsername(), preferenceHelper.getOwnCloudPassword(), preferenceHelper.getOwnCloudDirectory()); }
OwnCloudManager extends FileSender { @Override public boolean isAvailable() { return validSettings(preferenceHelper.getOwnCloudServerName(), preferenceHelper.getOwnCloudUsername(), preferenceHelper.getOwnCloudPassword(), preferenceHelper.getOwnCloudDirectory()); } }
OwnCloudManager extends FileSender { @Override public boolean isAvailable() { return validSettings(preferenceHelper.getOwnCloudServerName(), preferenceHelper.getOwnCloudUsername(), preferenceHelper.getOwnCloudPassword(), preferenceHelper.getOwnCloudDirectory()); } OwnCloudManager(PreferenceHelper preferenceHelper); }
OwnCloudManager extends FileSender { @Override public boolean isAvailable() { return validSettings(preferenceHelper.getOwnCloudServerName(), preferenceHelper.getOwnCloudUsername(), preferenceHelper.getOwnCloudPassword(), preferenceHelper.getOwnCloudDirectory()); } OwnCloudManager(PreferenceHelper preferenceHelper); void testOwnCloud(final String servername, final String username, final String password, final String directory); static boolean validSettings(
            String servername,
            String username,
            String password,
            String directory); @Override void uploadFile(List<File> files); @Override boolean isAvailable(); @Override boolean hasUserAllowedAutoSending(); void uploadFile(final File f); @Override boolean accept(File dir, String name); }
OwnCloudManager extends FileSender { @Override public boolean isAvailable() { return validSettings(preferenceHelper.getOwnCloudServerName(), preferenceHelper.getOwnCloudUsername(), preferenceHelper.getOwnCloudPassword(), preferenceHelper.getOwnCloudDirectory()); } OwnCloudManager(PreferenceHelper preferenceHelper); void testOwnCloud(final String servername, final String username, final String password, final String directory); static boolean validSettings(
            String servername,
            String username,
            String password,
            String directory); @Override void uploadFile(List<File> files); @Override boolean isAvailable(); @Override boolean hasUserAllowedAutoSending(); void uploadFile(final File f); @Override boolean accept(File dir, String name);  }