aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/src/com/android/tv/recommendation/RecentChannelEvaluatorTest.java
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-10-09 19:19:21 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-10-09 19:19:21 +0000
commit411c4a576a92253a386784dddb646a2671b5d6f9 (patch)
treed31e2adc1f9cce4f27ca07d30bee921032e33a3c /tests/unit/src/com/android/tv/recommendation/RecentChannelEvaluatorTest.java
parentbc7f430decab0bc34a533811efe457d4615f28aa (diff)
parentbb2e798ef4d546dd54cd9e95796403062b860c15 (diff)
downloadTV-411c4a576a92253a386784dddb646a2671b5d6f9.tar.gz
Change-Id: I06099c50eb5f4c5791fab1e6055cca20fb367c6d
Diffstat (limited to 'tests/unit/src/com/android/tv/recommendation/RecentChannelEvaluatorTest.java')
-rw-r--r--tests/unit/src/com/android/tv/recommendation/RecentChannelEvaluatorTest.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/unit/src/com/android/tv/recommendation/RecentChannelEvaluatorTest.java b/tests/unit/src/com/android/tv/recommendation/RecentChannelEvaluatorTest.java
index 55a4e4ac..8f092238 100644
--- a/tests/unit/src/com/android/tv/recommendation/RecentChannelEvaluatorTest.java
+++ b/tests/unit/src/com/android/tv/recommendation/RecentChannelEvaluatorTest.java
@@ -16,8 +16,12 @@
package com.android.tv.recommendation;
+import static org.junit.Assert.assertTrue;
+
import android.support.test.filters.SmallTest;
+import org.junit.Test;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -40,14 +44,16 @@ public class RecentChannelEvaluatorTest extends EvaluatorTestCase<RecentChannelE
return new RecentChannelEvaluator();
}
+ @Test
public void testOneChannelWithNoWatchLog() {
long channelId = addChannel().getId();
notifyChannelAndWatchLogLoaded();
- assertEquals(Recommender.Evaluator.NOT_RECOMMENDED,
+ assertEqualScores(Recommender.Evaluator.NOT_RECOMMENDED,
mEvaluator.evaluateChannel(channelId));
}
+ @Test
public void testOneChannelWithRandomWatchLogs() {
addChannel();
addRandomWatchLogs(DEFAULT_WATCH_START_TIME_MS, DEFAULT_WATCH_END_TIME_MS,
@@ -57,17 +63,19 @@ public class RecentChannelEvaluatorTest extends EvaluatorTestCase<RecentChannelE
assertChannelScoresValid();
}
+ @Test
public void testMultiChannelsWithNoWatchLog() {
addChannels(DEFAULT_NUMBER_OF_CHANNELS);
notifyChannelAndWatchLogLoaded();
List<Long> channelIdList = getChannelIdListSorted();
for (long channelId : channelIdList) {
- assertEquals(Recommender.Evaluator.NOT_RECOMMENDED,
+ assertEqualScores(Recommender.Evaluator.NOT_RECOMMENDED,
mEvaluator.evaluateChannel(channelId));
}
}
+ @Test
public void testMultiChannelsWithRandomWatchLogs() {
addChannels(DEFAULT_NUMBER_OF_CHANNELS);
addRandomWatchLogs(DEFAULT_WATCH_START_TIME_MS, DEFAULT_WATCH_END_TIME_MS,
@@ -77,6 +85,7 @@ public class RecentChannelEvaluatorTest extends EvaluatorTestCase<RecentChannelE
assertChannelScoresValid();
}
+ @Test
public void testMultiChannelsWithSimpleWatchLogs() {
addChannels(DEFAULT_NUMBER_OF_CHANNELS);
// Every channel has one watch log with 1 hour. Also, for two channels
@@ -99,6 +108,7 @@ public class RecentChannelEvaluatorTest extends EvaluatorTestCase<RecentChannelE
}
}
+ @Test
public void testScoreIncreasesWithNewWatchLog() {
addChannels(DEFAULT_NUMBER_OF_CHANNELS);
addRandomWatchLogs(DEFAULT_WATCH_START_TIME_MS, DEFAULT_WATCH_END_TIME_MS,
@@ -119,6 +129,7 @@ public class RecentChannelEvaluatorTest extends EvaluatorTestCase<RecentChannelE
}
}
+ @Test
public void testScoreDecreasesWithIncrementOfWatchedLogUpdatedTime() {
addChannels(DEFAULT_NUMBER_OF_CHANNELS);
addRandomWatchLogs(DEFAULT_WATCH_START_TIME_MS, DEFAULT_WATCH_END_TIME_MS,