1 16 package org.apache.commons.collections.map; 17 18 import java.util.HashMap ; 19 import java.util.Map ; 20 21 import junit.framework.Test; 22 import junit.framework.TestSuite; 23 24 import org.apache.commons.collections.OrderedMap; 25 import org.apache.commons.collections.Unmodifiable; 26 27 36 public class TestUnmodifiableOrderedMap extends AbstractTestOrderedMap { 37 38 public TestUnmodifiableOrderedMap(String testName) { 39 super(testName); 40 } 41 42 public static Test suite() { 43 return new TestSuite(TestUnmodifiableOrderedMap.class); 44 } 45 46 public static void main(String args[]) { 47 String [] testCaseName = { TestUnmodifiableOrderedMap.class.getName()}; 48 junit.textui.TestRunner.main(testCaseName); 49 } 50 51 53 public Map makeEmptyMap() { 54 return UnmodifiableOrderedMap.decorate(ListOrderedMap.decorate(new HashMap ())); 55 } 56 57 public boolean isPutChangeSupported() { 58 return false; 59 } 60 61 public boolean isPutAddSupported() { 62 return false; 63 } 64 65 public boolean isRemoveSupported() { 66 return false; 67 } 68 69 public Map makeFullMap() { 70 OrderedMap m = ListOrderedMap.decorate(new HashMap ()); 71 addSampleMappings(m); 72 return UnmodifiableOrderedMap.decorate(m); 73 } 74 75 public void testUnmodifiable() { 77 assertTrue(makeEmptyMap() instanceof Unmodifiable); 78 assertTrue(makeFullMap() instanceof Unmodifiable); 79 } 80 81 public void testDecorateFactory() { 82 Map map = makeFullMap(); 83 assertSame(map, UnmodifiableOrderedMap.decorate((OrderedMap) map)); 84 85 try { 86 UnmodifiableOrderedMap.decorate(null); 87 fail(); 88 } catch (IllegalArgumentException ex) {} 89 } 90 91 public String getCompatibilityVersion() { 92 return "3.1"; 93 } 94 95 } | Popular Tags |