### Question:
DropBoxManager extends FileSender { @Override public boolean isAvailable() { return isLinked() && preferenceHelper.getDropBoxAccessKeyName() != null; } DropBoxManager(PreferenceHelper preferenceHelper); boolean isLinked(); boolean finishAuthorization(); void startAuthentication(Context context); void unLink(); @Override void uploadFile(List<File> files); @Override boolean isAvailable(); @Override boolean hasUserAllowedAutoSending(); void uploadFile(final String fileName); @Override boolean accept(File dir, String name);  }### Answer:
@Test public void IsAvailable_WhenKeyPresent_ReturnsTrue(){ PreferenceHelper pm = mock(PreferenceHelper.class); when(pm.isDropboxAutoSendEnabled()).thenReturn(true); when(pm.getDropBoxAccessKeyName()).thenReturn("aaaaaa"); DropBoxManager dropBoxManager = new DropBoxManager(pm); assertThat("All values present means is available", dropBoxManager.isAvailable(), is(true)); }
@Test public void IsAvailable_WithKeyButAutoSendDisabled_ReturnsTrue(){ PreferenceHelper pm = mock(PreferenceHelper.class); when(pm.isDropboxAutoSendEnabled()).thenReturn(false); when(pm.getDropBoxAccessKeyName()).thenReturn("aaaaaa"); DropBoxManager dropBoxManager = new DropBoxManager(pm); assertThat("Allow normal sending even if autosend disabled", dropBoxManager.isAvailable(), is(true)); }