@Test public void testTwoLikes() { SparseVector vec = sum.summarize(History.forUser(42, Like.create(42, 39), Like.create(42, 67))); assertThat(vec.size(), equalTo(2)); assertThat(vec.get(39), equalTo(1.0)); assertThat(vec.get(67), equalTo(1.0)); }
@Test public void testLikeBatch() { SparseVector vec = sum.summarize( History.forUser( 42, Like.create(42, 39), LikeBatch.create(42, 67, 402), Like.create(42, 39))); assertThat(vec.size(), equalTo(2)); assertThat(vec.get(39), equalTo(2.0)); assertThat(vec.get(67), equalTo(402.0)); }
@Test public void testSummarizeNoLike() { SparseVector vec = sum.summarize(History.forUser(42, Rating.create(42, 39, 2.5))); assertThat(vec.size(), equalTo(0)); }
@Test public void testSummarizeEmpty() { SparseVector vec = sum.summarize(History.forUser(42)); assertThat(vec.size(), equalTo(0)); }