@Test public void testShuffleFile() throws IOException { boolean[] check = new boolean[3]; String outFile = "target/LineShufflerTest.txt"; LineShuffler.shuffle("org/databene/benerator/util/test.txt", outFile, 3); ReaderLineIterator iterator = new ReaderLineIterator(IOUtil.getReaderForURI(outFile)); int count = 0; while (iterator.hasNext()) { count++; int value = Integer.parseInt(iterator.next()); assertFalse(check[value]); check[value] = true; } assertEquals(3, count); for (boolean c : check) assertTrue(c); }
@Test public void testShuffleList() { LineShuffler.shuffle(CollectionUtil.toList("1", "2", "3")); }