### Question:
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);  }### Answer:
@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)); }