View Javadoc

1   package org.codehaus.modello.plugin.java.javasource;
2   
3   import junit.framework.TestCase;
4   
5   /**
6    * @author <a href="mailto:simonetripodi@apache.org">Simone Tripodi</a>
7    * @since 1.8
8    */
9   public final class JMapTypeTestCase
10      extends TestCase
11  {
12  
13      public void testJava5PropertiesType()
14      {
15          JMapType mapType = new JMapType( "java.util.Properties", new JClass( "String" ), true );
16  
17          assertEquals( "java.util.Properties", mapType.toString() );
18      }
19  
20      public void testJava4PropertiesType()
21      {
22          JMapType mapType = new JMapType( "java.util.Properties", new JClass( "String" ), false );
23  
24          assertEquals( "java.util.Properties", mapType.toString() );
25      }
26  
27      public void testJava5MapType()
28      {
29          JMapType mapType = new JMapType( "java.util.Map", new JClass( "String" ), true );
30  
31          assertEquals( "java.util.Map<Object, String>", mapType.toString() );
32      }
33  
34      public void testJava5MapInitialization()
35      {
36          JMapType mapType = new JMapType( "java.util.Map", "new java.util.HashMap()", new JClass( "String" ), true );
37  
38          assertEquals( "new java.util.HashMap<Object, String>()", mapType.getInstanceName() );
39      }
40  
41      public void testJava4MapType()
42      {
43          JMapType mapType = new JMapType( "java.util.Map", new JClass( "String" ), false );
44  
45          assertEquals( "java.util.Map/*<Object, String>*/", mapType.toString() );
46      }
47  
48      public void testJava4MapInitialization()
49      {
50          JMapType mapType = new JMapType( "java.util.Map", "new java.util.HashMap()", new JClass( "String" ), false );
51  
52          assertEquals( "new java.util.HashMap/*<Object, String>*/()", mapType.getInstanceName() );
53      }
54  
55  }