1   package org.rblasch.convert.type;
2   
3   import junit.framework.TestCase;
4   
5   /***
6    * @author Ronald Blaschke
7    */
8   public class TypesTest extends TestCase {
9       private class A {}
10  
11      public void testFindTypeByNameClass() throws Exception {
12          assertEquals("int", Types.findTypeByClass(Integer.TYPE).getName());
13          assertEquals("java.lang.Integer", Types.findTypeByClass(Integer.class).getName());
14          assertEquals("array<int>", Types.findTypeByClass(int[].class).getName());
15          assertEquals("array<java.lang.Integer>", Types.findTypeByClass(Integer[].class).getName());
16          assertEquals("array<array<java.lang.Integer>>", Types.findTypeByClass(Integer[][].class).getName());
17      }
18  
19      public void testFindTypeByNameString() throws Exception {
20          assertEquals("int", Types.findTypeByName("int").getName());
21          assertEquals(A.class.getName(), Types.findTypeByName(A.class.getName()).getName());
22          assertEquals("array<int>", Types.findTypeByName("int[]").getName());
23          assertEquals("array<" + A.class.getName() + ">", Types.findTypeByName(A.class.getName()+"[]").getName());
24      }
25  }