@Test public void take() { ArrayList<Integer> list = this.getIntegerList(); Assert.assertEquals(FastList.newListWith(5, 4), ArrayListIterate.take(list, 2)); Verify.assertSize(0, ArrayListIterate.take(list, 0)); Verify.assertSize(5, ArrayListIterate.take(list, 5)); Verify.assertSize(0, ArrayListIterate.take(new ArrayList<Integer>(), 2)); ArrayList<Integer> list1 = new ArrayList<Integer>(130); list1.addAll(Interval.oneTo(120)); Verify.assertListsEqual(Interval.oneTo(120), ArrayListIterate.take(list1, 125)); }
@Test(expected = IllegalArgumentException.class) public void take_throws() { ArrayListIterate.take(this.getIntegerList(), -1); }