@@ -0,0 +1,2396 @@
+/*%0A * LensKit, an open source recommender systems toolkit.%0A * Copyright 2010-2014 LensKit Contributors.  See CONTRIBUTORS.md.%0A * Work on LensKit has been funded by the National Science Foundation under%0A * grants IIS 05-34939, 08-08692, 08-12148, and 10-17697.%0A *%0A * This program is free software; you can redistribute it and/or modify%0A * it under the terms of the GNU Lesser General Public License as%0A * published by the Free Software Foundation; either version 2.1 of the%0A * License, or (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful, but WITHOUT%0A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS%0A * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more%0A * details.%0A *%0A * You should have received a copy of the GNU General Public License along with%0A * this program; if not, write to the Free Software Foundation, Inc., 51%0A * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%0A */%0Apackage org.lenskit.eval.crossfold;%0A%0Aimport org.junit.Test;%0Aimport org.lenskit.data.events.Event;%0Aimport org.lenskit.data.ratings.Rating;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Random;%0A%0Aimport static org.hamcrest.Matchers.*;%0Aimport static org.junit.Assert.*;%0A%0Apublic class SortOrderTest %7B%0A    @Test%0A    public void testRandom() %7B%0A        List%3CEvent%3E events = new ArrayList%3C%3E();%0A        events.add(Rating.create(42, 1, 3.5, 100));%0A        events.add(Rating.create(42, 2, 4.0, 105));%0A        events.add(Rating.create(42, 3, 2.5, 98));%0A%0A        List%3CEvent%3E copy = new ArrayList%3C%3E(events);%0A%0A        SortOrder.RANDOM.apply(copy, new Random());%0A%0A        assertThat(copy, hasSize(3));%0A        for (Event e: events) %7B%0A            assertThat(copy, hasItem(e));%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void testTimestamp() %7B%0A        List%3CRating%3E events = new ArrayList%3C%3E();%0A        events.add(Rating.create(42, 1, 3.5, 100));%0A        events.add(Rating.create(42, 2, 4.0, 105));%0A        events.add(Rating.create(42, 3, 2.5, 98));%0A%0A        List%3CRating%3E copy = new ArrayList%3C%3E(events);%0A%0A        SortOrder.TIMESTAMP.apply(copy, new Random());%0A%0A        assertThat(copy, hasSize(3));%0A        assertThat(copy, contains(Rating.create(42, 3, 2.5, 98),%0A                                  Rating.create(42, 1, 3.5, 100),%0A                                  Rating.create(42, 2, 4.0, 105)));%0A    %7D%0A%7D%0A

Add tests for crossfold sort order