aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/src/com/android/tv/data/GenreItemTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/src/com/android/tv/data/GenreItemTest.java')
-rw-r--r--tests/unit/src/com/android/tv/data/GenreItemTest.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/tests/unit/src/com/android/tv/data/GenreItemTest.java b/tests/unit/src/com/android/tv/data/GenreItemTest.java
index dbf99eac..02bf4b30 100644
--- a/tests/unit/src/com/android/tv/data/GenreItemTest.java
+++ b/tests/unit/src/com/android/tv/data/GenreItemTest.java
@@ -17,18 +17,18 @@
package com.android.tv.data;
import static android.support.test.InstrumentationRegistry.getTargetContext;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
import android.media.tv.TvContract.Programs.Genres;
import android.os.Build;
import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
+import org.junit.runner.RunWith;
/** Tests for {@link Channel}. */
@SmallTest
+@RunWith(AndroidJUnit4.class)
public class GenreItemTest {
private static final String INVALID_GENRE = "INVALID GENRE";
@@ -41,17 +41,17 @@ public class GenreItemTest {
@Test
public void testGetCanonicalGenre() {
int count = GenreItems.getGenreCount();
- assertNull(GenreItems.getCanonicalGenre(GenreItems.ID_ALL_CHANNELS));
+ assertThat(GenreItems.getCanonicalGenre(GenreItems.ID_ALL_CHANNELS)).isNull();
for (int i = 1; i < count; ++i) {
- assertNotNull(GenreItems.getCanonicalGenre(i));
+ assertThat(GenreItems.getCanonicalGenre(i)).isNotNull();
}
}
@Test
public void testGetId_base() {
int count = GenreItems.getGenreCount();
- assertEquals(GenreItems.ID_ALL_CHANNELS, GenreItems.getId(null));
- assertEquals(GenreItems.ID_ALL_CHANNELS, GenreItems.getId(INVALID_GENRE));
+ assertThat(GenreItems.getId(null)).isEqualTo(GenreItems.ID_ALL_CHANNELS);
+ assertThat(GenreItems.getId(INVALID_GENRE)).isEqualTo(GenreItems.ID_ALL_CHANNELS);
assertInRange(GenreItems.getId(Genres.FAMILY_KIDS), 1, count - 1);
assertInRange(GenreItems.getId(Genres.SPORTS), 1, count - 1);
assertInRange(GenreItems.getId(Genres.SHOPPING), 1, count - 1);
@@ -68,12 +68,13 @@ public class GenreItemTest {
@Test
public void testGetId_lmp_mr1() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
- assertEquals(GenreItems.ID_ALL_CHANNELS, GenreItems.getId(Genres.ARTS));
- assertEquals(GenreItems.ID_ALL_CHANNELS, GenreItems.getId(Genres.ENTERTAINMENT));
- assertEquals(GenreItems.ID_ALL_CHANNELS, GenreItems.getId(Genres.LIFE_STYLE));
- assertEquals(GenreItems.ID_ALL_CHANNELS, GenreItems.getId(Genres.MUSIC));
- assertEquals(GenreItems.ID_ALL_CHANNELS, GenreItems.getId(Genres.PREMIER));
- assertEquals(GenreItems.ID_ALL_CHANNELS, GenreItems.getId(Genres.TECH_SCIENCE));
+ assertThat(GenreItems.getId(Genres.ARTS)).isEqualTo(GenreItems.ID_ALL_CHANNELS);
+ assertThat(GenreItems.getId(Genres.ENTERTAINMENT))
+ .isEqualTo(GenreItems.ID_ALL_CHANNELS);
+ assertThat(GenreItems.getId(Genres.LIFE_STYLE)).isEqualTo(GenreItems.ID_ALL_CHANNELS);
+ assertThat(GenreItems.getId(Genres.MUSIC)).isEqualTo(GenreItems.ID_ALL_CHANNELS);
+ assertThat(GenreItems.getId(Genres.PREMIER)).isEqualTo(GenreItems.ID_ALL_CHANNELS);
+ assertThat(GenreItems.getId(Genres.TECH_SCIENCE)).isEqualTo(GenreItems.ID_ALL_CHANNELS);
} else {
int count = GenreItems.getGenreCount();
assertInRange(GenreItems.getId(Genres.ARTS), 1, count - 1);
@@ -86,6 +87,6 @@ public class GenreItemTest {
}
private void assertInRange(int value, int lower, int upper) {
- assertTrue(value >= lower && value <= upper);
+ assertThat(value >= lower && value <= upper).isTrue();
}
}