Fix a style issue and fix the test
This commit is contained in:
parent
c327fd75ee
commit
ebc0200968
@ -132,6 +132,8 @@ public class DBWriterTest extends InstrumentationTestCase {
|
||||
|
||||
public void testDeleteFeedMediaOfItemRemoveFromQueue()
|
||||
throws IOException, ExecutionException, InterruptedException, TimeoutException {
|
||||
assertTrue(UserPreferences.shouldDeleteRemoveFromQueue());
|
||||
|
||||
File dest = new File(getInstrumentation().getTargetContext().getExternalFilesDir(TEST_FOLDER), "testFile");
|
||||
|
||||
assertTrue(dest.createNewFile());
|
||||
@ -158,8 +160,8 @@ public class DBWriterTest extends InstrumentationTestCase {
|
||||
queue = DBReader.getQueue();
|
||||
assertTrue(queue.size() != 0);
|
||||
|
||||
DBWriter.deleteFeedMediaOfItem(getInstrumentation().getTargetContext(), media.getId())
|
||||
.get(TIMEOUT, TimeUnit.SECONDS);
|
||||
DBWriter.deleteFeedMediaOfItem(getInstrumentation().getTargetContext(), media.getId());
|
||||
Thread.sleep(200);
|
||||
media = DBReader.getFeedMedia(media.getId());
|
||||
assertNotNull(media);
|
||||
assertFalse(dest.exists());
|
||||
|
@ -138,10 +138,11 @@ public class DBWriter {
|
||||
*/
|
||||
public static Future<?> deleteFeedMediaOfItem(final Context context,
|
||||
final long mediaId) {
|
||||
Future res = doDeleteFeedMediaOfItem(context, mediaId);
|
||||
if (UserPreferences.shouldDeleteRemoveFromQueue()) {
|
||||
DBWriter.removeQueueItem(context, DBReader.getFeedMedia(mediaId).getItem(), false);
|
||||
}
|
||||
return doDeleteFeedMediaOfItem(context, mediaId);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user