diff options
Diffstat (limited to 'tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java')
-rw-r--r-- | tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java b/tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java index 91d61c06..9af5fd06 100644 --- a/tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java +++ b/tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java @@ -16,21 +16,20 @@ package com.android.tv.recommendation; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; import android.support.test.filters.SmallTest; import android.support.test.runner.AndroidJUnit4; -import android.test.MoreAsserts; import com.android.tv.data.Program; import com.android.tv.recommendation.RoutineWatchEvaluator.ProgramTime; -import java.util.Arrays; import java.util.Calendar; import java.util.List; -import java.util.TreeSet; import java.util.concurrent.TimeUnit; import org.junit.Test; import org.junit.runner.RunWith; +/**Tests for {@link RoutineWatchEvaluator}. */ @SmallTest @RunWith(AndroidJUnit4.class) public class RoutineWatchEvaluatorTest extends EvaluatorTestCase<RoutineWatchEvaluator> { @@ -112,11 +111,15 @@ public class RoutineWatchEvaluatorTest extends EvaluatorTestCase<RoutineWatchEva @Test public void testCalculateTitleMatchScore_longerMatchIsBetter() { String base = "foo bar baz"; - assertInOrder( - score(base, ""), - score(base, "bar"), - score(base, "foo bar"), - score(base, "foo bar baz")); + assertThat( + new ScoredItem[] { + score(base, ""), + score(base, "bar"), + score(base, "foo bar"), + score(base, "foo bar baz") + }) + .asList() + .isOrdered(); } @Test @@ -231,7 +234,7 @@ public class RoutineWatchEvaluatorTest extends EvaluatorTestCase<RoutineWatchEva private void assertSplitTextToWords(String text, String... words) { List<String> wordList = RoutineWatchEvaluator.splitTextToWords(text); - MoreAsserts.assertContentsInOrder(wordList, words); + assertThat(wordList).containsExactly((Object) words).inOrder(); } private void assertMaximumMatchedWordSequenceLength( @@ -317,9 +320,4 @@ public class RoutineWatchEvaluatorTest extends EvaluatorTestCase<RoutineWatchEva .setEndTimeUtcMillis(startTimeMs + programDurationMs) .build(); } - - private static <T> void assertInOrder(T... items) { - TreeSet<T> copy = new TreeSet<>(Arrays.asList(items)); - MoreAsserts.assertContentsInOrder(copy, items); - } } |