This commit is contained in:
parent
dcd40d4cac
commit
994ee0e0a2
|
@ -21,6 +21,7 @@ import java.util.Set;
|
|||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.event.DownloadLogEvent;
|
||||
|
@ -72,6 +73,18 @@ public class DBWriter {
|
|||
private DBWriter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait until all threads are finished to avoid the "Illegal connection pointer" error of
|
||||
* Robolectric. Call this method only for unit tests.
|
||||
*/
|
||||
public static void tearDownTests() {
|
||||
try {
|
||||
dbExec.awaitTermination(1, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
// ignore error
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a downloaded FeedMedia file from the storage device.
|
||||
*
|
||||
|
|
|
@ -30,6 +30,7 @@ import de.danoeh.antennapod.core.ClientConfig;
|
|||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -81,6 +82,7 @@ public class LocalFeedUpdaterTest {
|
|||
|
||||
@After
|
||||
public void tearDown() {
|
||||
DBWriter.tearDownTests();
|
||||
PodDBAdapter.tearDownTests();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue