aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java')
-rw-r--r--tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java52
1 files changed, 26 insertions, 26 deletions
diff --git a/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java b/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java
index 4512bb7d..d84a90d4 100644
--- a/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java
+++ b/tests/unit/src/com/android/tv/util/TvTrackInfoUtilsTest.java
@@ -16,24 +16,22 @@
package com.android.tv.util;
import static com.android.tv.util.TvTrackInfoUtils.getBestTrackInfo;
-import static org.junit.Assert.assertEquals;
+import static com.google.common.truth.Truth.assertWithMessage;
import android.media.tv.TvTrackInfo;
import android.support.test.filters.SmallTest;
-
+import android.support.test.runner.AndroidJUnit4;
import com.android.tv.testing.ComparatorTester;
-
-import org.junit.Test;
-
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-/**
- * Tests for {@link com.android.tv.util.TvTrackInfoUtils}.
- */
+/** Tests for {@link com.android.tv.util.TvTrackInfoUtils}. */
@SmallTest
+@RunWith(AndroidJUnit4.class)
public class TvTrackInfoUtilsTest {
private static final String UN_MATCHED_ID = "no matching ID";
@@ -54,57 +52,57 @@ public class TvTrackInfoUtilsTest {
.build();
}
- private static final List<TvTrackInfo> ALL = Arrays.asList(INFO_1_EN_1, INFO_2_EN_5,
- INFO_3_FR_8, INFO_4_NULL_2, INFO_5_NULL_6);
- private static final List<TvTrackInfo> NULL_LANGUAGE_TRACKS = Arrays.asList(INFO_4_NULL_2,
- INFO_5_NULL_6);
+ private static final List<TvTrackInfo> ALL =
+ Arrays.asList(INFO_1_EN_1, INFO_2_EN_5, INFO_3_FR_8, INFO_4_NULL_2, INFO_5_NULL_6);
+ 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);
+ assertWithMessage("best track ").that(result).isEqualTo(null);
}
@Test
public void testGetBestTrackInfo_exactMatch() {
TvTrackInfo result = getBestTrackInfo(ALL, "1", "en", 1);
- assertEquals("best track ", INFO_1_EN_1, result);
+ assertWithMessage("best track ").that(result).isEqualTo(INFO_1_EN_1);
}
@Test
public void testGetBestTrackInfo_langAndChannelCountMatch() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, "en", 5);
- assertEquals("best track ", INFO_2_EN_5, result);
+ assertWithMessage("best track ").that(result).isEqualTo(INFO_2_EN_5);
}
@Test
public void testGetBestTrackInfo_languageOnlyMatch() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, "fr", 1);
- assertEquals("best track ", INFO_3_FR_8, result);
+ assertWithMessage("best track ").that(result).isEqualTo(INFO_3_FR_8);
}
@Test
public void testGetBestTrackInfo_channelCountOnlyMatchWithNullLanguage() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, null, 8);
- assertEquals("best track ", INFO_3_FR_8, result);
+ assertWithMessage("best track ").that(result).isEqualTo(INFO_3_FR_8);
}
@Test
public void testGetBestTrackInfo_noMatches() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, "kr", 1);
- assertEquals("best track ", INFO_1_EN_1, result);
+ assertWithMessage("best track ").that(result).isEqualTo(INFO_1_EN_1);
}
@Test
public void testGetBestTrackInfo_noMatchesWithNullLanguage() {
TvTrackInfo result = getBestTrackInfo(ALL, UN_MATCHED_ID, null, 0);
- assertEquals("best track ", INFO_1_EN_1, result);
+ assertWithMessage("best track ").that(result).isEqualTo(INFO_1_EN_1);
}
@Test
public void testGetBestTrackInfo_channelCountAndIdMatch() {
TvTrackInfo result = getBestTrackInfo(NULL_LANGUAGE_TRACKS, "5", null, 6);
- assertEquals("best track ", INFO_5_NULL_6, result);
+ assertWithMessage("best track ").that(result).isEqualTo(INFO_5_NULL_6);
}
@Test
@@ -112,15 +110,17 @@ public class TvTrackInfoUtilsTest {
Comparator<TvTrackInfo> comparator = TvTrackInfoUtils.createComparator("1", "en", 1);
ComparatorTester.withoutEqualsTest(comparator)
// lang not match
- .addComparableGroup(create("1", "kr", 1), create("2", "kr", 2),
+ .addComparableGroup(
+ create("1", "kr", 1),
+ create("2", "kr", 2),
create("1", "ja", 1),
create("1", "ch", 1))
- // lang match not count match
- .addComparableGroup(create("2", "en", 2), create("3", "en", 3),
- create("1", "en", 2))
- // lang and count match
+ // lang match not count match
+ .addComparableGroup(
+ create("2", "en", 2), create("3", "en", 3), create("1", "en", 2))
+ // lang and count match
.addComparableGroup(create("2", "en", 1), create("3", "en", 1))
- // all match
+ // all match
.addComparableGroup(create("1", "en", 1), create("1", "en", 1))
.test();
}