KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > math > util > TransformerMapTest


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.commons.math.util;
18
19 import junit.framework.TestCase;
20
21 /**
22  * @version $Revision$ $Date: 2005-02-26 05:11:52 -0800 (Sat, 26 Feb 2005) $
23  */

24 public class TransformerMapTest extends TestCase {
25     /**
26      *
27      */

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     /**
37      *
38      */

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     /**
47      *
48      */

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     /**
57      *
58      */

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     /**
72      *
73      */

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     /**
85      *
86      */

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     /**
95      *
96      */

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