1 16 17 package org.apache.commons.math.util; 18 19 import junit.framework.TestCase; 20 21 24 public class TransformerMapTest extends TestCase { 25 28 public void testPutTransformer(){ 29 NumberTransformer expected = new DefaultTransformer(); 30 31 TransformerMap map = new TransformerMap(); 32 map.putTransformer(TransformerMapTest.class, expected); 33 assertEquals(expected, map.getTransformer(TransformerMapTest.class)); 34 } 35 36 39 public void testContainsClass(){ 40 NumberTransformer expected = new DefaultTransformer(); 41 TransformerMap map = new TransformerMap(); 42 map.putTransformer(TransformerMapTest.class, expected); 43 assertTrue(map.containsClass(TransformerMapTest.class)); 44 } 45 46 49 public void testContainsTransformer(){ 50 NumberTransformer expected = new DefaultTransformer(); 51 TransformerMap map = new TransformerMap(); 52 map.putTransformer(TransformerMapTest.class, expected); 53 assertTrue(map.containsTransformer(expected)); 54 } 55 56 59 public void testRemoveTransformer(){ 60 NumberTransformer expected = new DefaultTransformer(); 61 62 TransformerMap map = new TransformerMap(); 63 map.putTransformer(TransformerMapTest.class, expected); 64 assertTrue(map.containsClass(TransformerMapTest.class)); 65 assertTrue(map.containsTransformer(expected)); 66 map.removeTransformer(TransformerMapTest.class); 67 assertFalse(map.containsClass(TransformerMapTest.class)); 68 assertFalse(map.containsTransformer(expected)); 69 } 70 71 74 public void testClear(){ 75 NumberTransformer expected = new DefaultTransformer(); 76 77 TransformerMap map = new TransformerMap(); 78 map.putTransformer(TransformerMapTest.class, expected); 79 assertTrue(map.containsClass(TransformerMapTest.class)); 80 map.clear(); 81 assertFalse(map.containsClass(TransformerMapTest.class)); 82 } 83 84 87 public void testClasses(){ 88 NumberTransformer expected = new DefaultTransformer(); 89 TransformerMap map = new TransformerMap(); 90 map.putTransformer(TransformerMapTest.class, expected); 91 assertTrue(map.classes().contains(TransformerMapTest.class)); 92 } 93 94 97 public void testTransformers(){ 98 NumberTransformer expected = new DefaultTransformer(); 99 TransformerMap map = new TransformerMap(); 100 map.putTransformer(TransformerMapTest.class, expected); 101 assertTrue(map.transformers().contains(expected)); 102 } 103 } 104 | Popular Tags |