You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/04/11 12:49:29 UTC
svn commit: r1091017 -
/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
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());
+ }
+
}