commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1091017 - /commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
Date Mon, 11 Apr 2011 10:49:29 GMT
Author: mturk
Date: Mon Apr 11 10:49:29 2011
New Revision: 1091017

URL: http://svn.apache.org/viewvc?rev=1091017&view=rev
Log:
Test cases

Modified:
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java?rev=1091017&r1=1091016&r2=1091017&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
Mon Apr 11 10:49:29 2011
@@ -26,10 +26,24 @@ public class TestReflect
     @Test(groups = { "utils" })
     public void testFindClass()
     {
-        Class c1 = Reflect.findClass("java/lang/System");
+        // Uses JNI class naming.
+        Class c1 = Reflect.findClass("Ljava/lang/System;");
         Assert.assertEquals("java.lang.System", c1.getCanonicalName());
         Class c2 = Reflect.findClass("java.lang.System");
         Assert.assertEquals("java.lang.System", c1.getCanonicalName());
     }
 
+    @Test(groups = { "utils" })
+    public void testAllocObject()
+        throws Exception
+    {
+        Class sc = Reflect.findClass("java/lang/String");
+        Assert.assertEquals("java.lang.String", sc.getCanonicalName());
+        Object o = Reflect.allocObject(sc);
+        Assert.assertNotNull(o);
+        // Returns empty string since object was not initialized
+        // only allocated.
+        Assert.assertEquals("", o.toString());
+    }
+
 }



Mime
View raw message