@@ -0,0 +1,2287 @@
+package org.grouplens.lenskit.eval.data.traintest;%0A%0Aimport static org.hamcrest.CoreMatchers.equalTo;%0Aimport static org.junit.Assert.assertThat;%0A%0Aimport java.util.List;%0A%0Aimport org.grouplens.lenskit.data.event.Rating;%0Aimport org.grouplens.lenskit.data.event.SimpleRating;%0Aimport org.junit.Test;%0A%0Aimport com.google.common.collect.Lists;%0A%0A/**%0A * @author Michael Ekstrand %3Cekstrand@cs.umn.edu%3E%0A *%0A */%0Apublic class TestHoldoutMode %7B%0A    Rating%5B%5D ratings = %7B%0A            new SimpleRating(0, 5, 1, 3, 5),%0A            new SimpleRating(1, 5, 4, 2.5, 7),%0A            new SimpleRating(2, 5, 42, 1.0, 1),%0A            new SimpleRating(3, 5, 37, 3, 9)%0A    %7D;%0A%0A    @Test%0A    public void testRandFromString() %7B%0A        assertThat(HoldoutMode.fromString(%22random%22), equalTo(HoldoutMode.RANDOM));%0A        assertThat(HoldoutMode.fromString(%22Random%22), equalTo(HoldoutMode.RANDOM));%0A    %7D%0A    %0A    @Test%0A    public void testTimestampFromString() %7B%0A        assertThat(HoldoutMode.fromString(%22time%22), equalTo(HoldoutMode.TIMESTAMP));%0A        assertThat(HoldoutMode.fromString(%22Time%22), equalTo(HoldoutMode.TIMESTAMP));%0A    %7D%0A    %0A    @Test(expected=IllegalArgumentException.class)%0A    public void testTimestampInvalid() %7B%0A        HoldoutMode.fromString(%22foo%22);%0A    %7D%0A    %0A    @Test%0A    public void testRandomList() %7B%0A        List%3CRating%3E rlst = Lists.newArrayList(ratings);%0A        int p = HoldoutMode.RANDOM.partition(rlst, 2);%0A        assertThat(p, equalTo(2));%0A    %7D%0A    %0A    @Test%0A    public void testRandomListLong() %7B%0A        List%3CRating%3E rlst = Lists.newArrayList(ratings);%0A        int p = HoldoutMode.RANDOM.partition(rlst, 5);%0A        assertThat(p, equalTo(0));%0A    %7D%0A    %0A    @Test%0A    public void testTSList() %7B%0A        List%3CRating%3E rlst = Lists.newArrayList(ratings);%0A        int p = HoldoutMode.TIMESTAMP.partition(rlst, 1);%0A        assertThat(p, equalTo(3));%0A        assertThat(rlst.get(0).getId(), equalTo(2l));%0A        assertThat(rlst.get(1).getId(), equalTo(0l));%0A        assertThat(rlst.get(2).getId(), equalTo(1l));%0A        assertThat(rlst.get(3).getId(), equalTo(3l));%0A    %7D%0A    %0A    @Test%0A    public void testTSListLong() %7B%0A        List%3CRating%3E rlst = Lists.newArrayList(ratings);%0A        int p = HoldoutMode.TIMESTAMP.partition(rlst, 5);%0A        assertThat(p, equalTo(0));        %0A    %7D%0A%0A%7D%0A

Add tests to verify holdout modes work correctly (closes #114)