1 16 package org.apache.commons.collections.map; 17 18 import java.util.Map ; 19 import java.util.SortedMap ; 20 import java.util.TreeMap ; 21 22 import junit.framework.Test; 23 import junit.framework.TestSuite; 24 25 import org.apache.commons.collections.Unmodifiable; 26 27 36 public class TestUnmodifiableSortedMap extends AbstractTestSortedMap { 37 38 public TestUnmodifiableSortedMap(String testName) { 39 super(testName); 40 } 41 42 public static Test suite() { 43 return new TestSuite(TestUnmodifiableSortedMap.class); 44 } 45 46 public static void main(String args[]) { 47 String [] testCaseName = { TestUnmodifiableSortedMap.class.getName()}; 48 junit.textui.TestRunner.main(testCaseName); 49 } 50 51 53 public Map makeEmptyMap() { 54 return UnmodifiableSortedMap.decorate(new TreeMap ()); 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 SortedMap m = new TreeMap (); 71 addSampleMappings(m); 72 return UnmodifiableSortedMap.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, UnmodifiableSortedMap.decorate((SortedMap ) map)); 84 85 try { 86 UnmodifiableSortedMap.decorate(null); 87 fail(); 88 } catch (IllegalArgumentException ex) {} 89 } 90 91 public String getCompatibilityVersion() { 92 return "3.1"; 93 } 94 95 } | Popular Tags |