//
// $Id: CollectionUtilTest.java,v 1.1 2002/04/11 04:11:23 mdb Exp $

package com.samskivert.util;

import java.util.ArrayList;
import java.util.List;

import junit.framework.Test;
import junit.framework.TestCase;

/**
 * Tests the {@link CollectionUtil} class.
 */
public class CollectionUtilTest extends TestCase
{
    public CollectionUtilTest ()
    {
        super(CollectionUtil.class.getName());
    }

    public void runTest ()
    {
        ArrayList list = new ArrayList();
        for (int i = 0; i < 100; i++) {
            list.add(new Integer(i));
        }

        for (int i = 0; i < 10; i++) {
            List subset = CollectionUtil.selectRandomSubset(list, 10);
            // System.out.println(StringUtil.toString(subset));
            assertTrue("length == 10", subset.size() == 10);
        }
    }

    public static Test suite ()
    {
        return new CollectionUtilTest();
    }

    public static void main (String[] args)
    {
        CollectionUtilTest test = new CollectionUtilTest();
        test.runTest();
    }
}

@@ -36,29 +36,29 @@
 v 1.
-1
+2
  2002/0
-4/11 04:11:23
+9/23 01:45:47
  mdb
@@ -145,16 +145,41 @@
 il.List;
+%0Aimport java.util.Random;
 %0A%0Aimport
@@ -838,16 +838,365 @@
        %7D
+%0A%0A        // test sortable array list insertion%0A        Random rand = new Random();%0A        SortableArrayList slist = new SortableArrayList();%0A        for (int ii = 0; ii %3C 25; ii++) %7B%0A            Integer value = new Integer(rand.nextInt(100));%0A            slist.insertSorted(value);%0A        %7D%0A        System.out.println(StringUtil.toString(slist));
 %0A    %7D%0A%0A

Test SortableArrayList.insertSorted().