diff options
-rw-r--r-- | tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java b/tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java index 9af5fd06..39e6e9c5 100644 --- a/tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java +++ b/tests/unit/src/com/android/tv/recommendation/RoutineWatchEvaluatorTest.java @@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit; import org.junit.Test; import org.junit.runner.RunWith; -/**Tests for {@link RoutineWatchEvaluator}. */ +/** Tests for {@link RoutineWatchEvaluator}. */ @SmallTest @RunWith(AndroidJUnit4.class) public class RoutineWatchEvaluatorTest extends EvaluatorTestCase<RoutineWatchEvaluator> { @@ -66,13 +66,23 @@ public class RoutineWatchEvaluatorTest extends EvaluatorTestCase<RoutineWatchEva @Test public void testSplitTextToWords() { - assertSplitTextToWords(""); - assertSplitTextToWords("Google", "Google"); - assertSplitTextToWords("The Big Bang Theory", "The", "Big", "Bang", "Theory"); - assertSplitTextToWords("Hello, world!", "Hello", "world"); - assertSplitTextToWords("Adam's Rib", "Adam's", "Rib"); - assertSplitTextToWords("G.I. Joe", "G.I", "Joe"); - assertSplitTextToWords("A.I.", "A.I"); + assertThat(RoutineWatchEvaluator.splitTextToWords("")).containsExactly().inOrder(); + assertThat(RoutineWatchEvaluator.splitTextToWords("Google")) + .containsExactly("Google") + .inOrder(); + assertThat(RoutineWatchEvaluator.splitTextToWords("The Big Bang Theory")) + .containsExactly("The", "Big", "Bang", "Theory") + .inOrder(); + assertThat(RoutineWatchEvaluator.splitTextToWords("Hello, world!")) + .containsExactly("Hello", "world") + .inOrder(); + assertThat(RoutineWatchEvaluator.splitTextToWords("Adam's Rib")) + .containsExactly("Adam's", "Rib") + .inOrder(); + assertThat(RoutineWatchEvaluator.splitTextToWords("G.I. Joe")) + .containsExactly("G.I", "Joe") + .inOrder(); + assertThat(RoutineWatchEvaluator.splitTextToWords("A.I.")).containsExactly("A.I").inOrder(); } @Test @@ -232,11 +242,6 @@ public class RoutineWatchEvaluatorTest extends EvaluatorTestCase<RoutineWatchEva RoutineWatchEvaluator.getTimeOfDayInSec(todayAtHourMinSec(23, 59, 59))); } - private void assertSplitTextToWords(String text, String... words) { - List<String> wordList = RoutineWatchEvaluator.splitTextToWords(text); - assertThat(wordList).containsExactly((Object) words).inOrder(); - } - private void assertMaximumMatchedWordSequenceLength( int expectedLength, String text1, String text2) { List<String> wordList1 = RoutineWatchEvaluator.splitTextToWords(text1); |