core tests: Make DownloadServiceTest be a unit test (the portion of
DownloadService tested is all in-memory logic).
This commit is contained in:
parent
46ae3e0b00
commit
eb0ef1e201
@ -7,8 +7,6 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
@ -1107,7 +1105,7 @@ public class DownloadService extends Service {
|
||||
* that every image reference is unique.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public static void removeDuplicateImages(Feed feed) {
|
||||
static void removeDuplicateImages(Feed feed) {
|
||||
Set<String> known = new HashSet<>();
|
||||
for (FeedItem item : feed.getItems()) {
|
||||
String url = item.hasItemImage() ? item.getImage().getDownload_url() : null;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.danoeh.antennapod.core.service.download;
|
||||
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -9,8 +10,11 @@ import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.feed.FeedImage;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
|
||||
public class DownloadServiceTest extends AndroidTestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class DownloadServiceTest {
|
||||
|
||||
@Test
|
||||
public void testRemoveDuplicateImages() {
|
||||
List<FeedItem> items = new ArrayList<>();
|
||||
for (int i = 0; i < 50; i++) {
|
Loading…
x
Reference in New Issue
Block a user