    @Test
    public void testCrossValidation() {

        DataModelIF<Long, Long> dm = DataModelFactory.getDefaultModel();
        for (long u = 1L; u <= USERS; u++) {
            for (long i = 1L; i <= ITEMS; i++) {
                dm.addPreference(u, i, 1.0 * u * i);
            }
        }

        int nFolds = 5;

        DataModelIF<Long, Long>[] splits = null;
        splits = new CrossValidationSplitter<Long, Long>(nFolds, false, 1L).split(dm);

        assertTrue(splits.length == 2 * nFolds);

        // Let's take one (user, item) pair from one test
        Long userTest = -1L;
        Long itemTest = -1L;
        for (Long user : splits[1].getUsers()) {
            userTest = user;
            for (Long item : splits[1].getUserItems(userTest)) {
                itemTest = item;
                break;
            }
            break;
        }

        // Let's check this pair is not in its corresponding training split
        assertTrue((splits[0].getUserItems(userTest) == null) || (Double.isNaN(splits[0].getUserItemPreference(userTest, itemTest))));

        for (int i = 1; i < splits.length / 2; i++) {
            DataModelIF<Long, Long> training = splits[2 * i];
            DataModelIF<Long, Long> test = splits[2 * i + 1];
            // Let's check this pair is not in any other test split
            assertTrue((test.getUserItems(userTest) == null) || (Double.isNaN(test.getUserItemPreference(userTest, itemTest))));
            // Let's check this pair is in every other training split
            assertTrue(!Double.isNaN(training.getUserItemPreference(userTest, itemTest)));
        }
    }