aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java
diff options
context:
space:
mode:
authorNick Chalko <nchalko@google.com>2017-10-03 10:16:37 -0700
committerNick Chalko <nchalko@google.com>2017-10-04 13:48:13 +0000
commit6ebde20b03db4c0d57f67acaac11832b610b966b (patch)
treed31e2adc1f9cce4f27ca07d30bee921032e33a3c /tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java
parentee027a576ddebaf1ae739219be01b0240b15f80c (diff)
downloadTV-6ebde20b03db4c0d57f67acaac11832b610b966b.tar.gz
Sync to match Live Channels 1.15(ncis)oreo-mr1-dev
aka ub-tv-dev at a73a150bb7d0d1ce867ef980c6ac8411899d40ad Bug: 64021596 Change-Id: I7c544fd15e2c58784f8babc31877ad0dfeebb4c0 (cherry picked from commit 633eb826b8c97731dfc5ef12c7bf78a63734275d)
Diffstat (limited to 'tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java')
-rw-r--r--tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java b/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java
index 9600fc0b..4512bb7d 100644
--- a/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java
+++ b/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java
@@ -16,13 +16,14 @@
package com.android.tv.util;
import static com.android.tv.util.TvTrackInfoUtils.getBestTrackInfo;
+import static org.junit.Assert.assertEquals;
import android.media.tv.TvTrackInfo;
import android.support.test.filters.SmallTest;
import com.android.tv.testing.ComparatorTester;
-import junit.framework.TestCase;
+import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
@@ -33,8 +34,7 @@ import java.util.List;
* Tests for {@link com.android.tv.util.TvTrackInfoUtils}.
*/
@SmallTest
-public class TvTrackInfoUtilsTest extends TestCase {
-
+public class TvTrackInfoUtilsTest {
private static final String UN_MATCHED_ID = "no matching ID";
private static final TvTrackInfo INFO_1_EN_1 = create("1", "en", 1);
@@ -59,46 +59,55 @@ public class TvTrackInfoUtilsTest extends TestCase {
private static final List<TvTrackInfo> NULL_LANGUAGE_TRACKS = Arrays.asList(INFO_4_NULL_2,
INFO_5_NULL_6);
+ @Test
public void testGetBestTrackInfo_empty() {
TvTrackInfo result = getBestTrackInfo(Collections.emptyList(), UN_MATCHED_ID, "en", 1);
assertEquals("best track ", null, result);
}
+ @Test
public void testGetBestTrackInfo_exactMatch() {
TvTrackInfo result = getBestTrackInfo(ALL, "1", "en", 1);
assertEquals("best track ", INFO_1_EN_1, result);
}
+ @Test
public void testGetBestTrackInfo_langAndChannelCountMatch() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, "en", 5);
assertEquals("best track ", INFO_2_EN_5, result);
}
+ @Test
public void testGetBestTrackInfo_languageOnlyMatch() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, "fr", 1);
assertEquals("best track ", INFO_3_FR_8, result);
}
+ @Test
public void testGetBestTrackInfo_channelCountOnlyMatchWithNullLanguage() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, null, 8);
assertEquals("best track ", INFO_3_FR_8, result);
}
+ @Test
public void testGetBestTrackInfo_noMatches() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, "kr", 1);
assertEquals("best track ", INFO_1_EN_1, result);
}
+ @Test
public void testGetBestTrackInfo_noMatchesWithNullLanguage() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, null, 0);
assertEquals("best track ", INFO_1_EN_1, result);
}
+ @Test
public void testGetBestTrackInfo_channelCountAndIdMatch() {
TvTrackInfo result = getBestTrackInfo(NULL_LANGUAGE_TRACKS, "5", null, 6);
assertEquals("best track ", INFO_5_NULL_6, result);
}
+ @Test
public void testComparator() {
Comparator<TvTrackInfo> comparator = TvTrackInfoUtils.createComparator("1", "en", 1);
ComparatorTester.withoutEqualsTest(comparator)