01: package org.drools.util;
02:
03: import junit.framework.TestCase;
04:
05: public class ClassUtilsTest extends TestCase {
06:
07: protected void setUp() throws Exception {
08: super .setUp();
09: }
10:
11: protected void tearDown() throws Exception {
12: super .tearDown();
13: }
14:
15: public void testCanonicalNameSimpleClass() {
16: String name = ClassUtils.canonicalName(ClassUtilsTest.class);
17: assertEquals("org.drools.util.ClassUtilsTest", name);
18: }
19:
20: public void testCanonicalNameInnerClass() {
21: String name = ClassUtils.canonicalName(A.class);
22: assertEquals("org.drools.util.ClassUtilsTest.A", name);
23: }
24:
25: public void testCanonicalNameInnerInnerClass() {
26: String name = ClassUtils.canonicalName(A.B.class);
27: assertEquals("org.drools.util.ClassUtilsTest.A.B", name);
28: }
29:
30: public void testCanonicalNameArray() {
31: String name = ClassUtils.canonicalName(Object[].class);
32: assertEquals("java.lang.Object[]", name);
33: }
34:
35: public void testCanonicalNameMultiIndexArray() {
36: String name = ClassUtils.canonicalName(Object[][][].class);
37: assertEquals("java.lang.Object[][][]", name);
38: }
39:
40: public void testCanonicalNameMultiIndexArrayInnerClass() {
41: String name = ClassUtils.canonicalName(A.B[][][].class);
42: assertEquals("org.drools.util.ClassUtilsTest.A.B[][][]", name);
43: }
44:
45: public void testCanonicalNameMultiIndexArrayPrimitives() {
46: String name = ClassUtils.canonicalName(long[][][].class);
47: assertEquals("long[][][]", name);
48: }
49:
50: public static class A {
51: public static class B {
52: }
53: }
54: }
|