1 15 package org.apache.tapestry.web; 16 17 import java.util.ArrayList ; 18 import java.util.Collections ; 19 import java.util.Enumeration ; 20 import java.util.List ; 21 22 import org.apache.hivemind.test.HiveMindTestCase; 23 import org.apache.tapestry.web.WebUtils; 24 25 31 public class TestWebUtils extends HiveMindTestCase 32 { 33 public void testToSortedList() 34 { 35 List l = new ArrayList (); 36 l.add("Fred"); 37 l.add("Barney"); 38 Enumeration e = Collections.enumeration(l); 39 40 l = WebUtils.toSortedList(e); 41 42 assertEquals(2, l.size()); 43 assertEquals("Barney", l.get(0)); 44 assertEquals("Fred", l.get(1)); 45 46 48 try 49 { 50 l.add("Wilma"); 51 unreachable(); 52 } 53 catch (UnsupportedOperationException ex) 54 { 55 } 57 } 58 59 public void testToSortedListEmpty() 60 { 61 List l = new ArrayList (); 62 Enumeration e = Collections.enumeration(l); 63 64 List sorted = WebUtils.toSortedList(e); 65 66 assertSame(Collections.EMPTY_LIST, sorted); 67 } 68 } | Popular Tags |