1 26 27 package net.sourceforge.groboutils.util.classes.v1; 28 29 import junit.framework.Test; 30 import junit.framework.TestCase; 31 import junit.framework.TestSuite; 32 33 34 41 public class ClassUtilOnlineUTest extends TestCase 42 { 43 private static final Class THIS_CLASS = ClassUtilOnlineUTest.class; 44 45 public ClassUtilOnlineUTest( String name ) 46 { 47 super( name ); 48 } 49 50 public static Test suite() 51 { 52 TestSuite suite = new TestSuite( THIS_CLASS ); 53 54 return suite; 55 } 56 57 public static void main( String [] args ) 58 { 59 String [] name = { THIS_CLASS.getName() }; 60 61 64 junit.textui.TestRunner.main( name ); 65 } 66 67 protected void setUp() throws Exception 68 { 69 super.setUp(); 70 71 } 73 74 75 protected void tearDown() throws Exception 76 { 77 79 super.tearDown(); 80 } 81 82 83 84 private static final String BELIEF_CLASS = "BeliefOfTheDay"; 85 private static final String BELIEF_JAR = 86 "http://groboutils.sourceforge.net/Belief.jar"; 87 88 public static class InnerClass 89 { 90 public InnerClass() 91 { 92 } 94 } 95 96 public void testGetClass1() 97 { 98 ClassUtil util = startTest(); 99 100 Class c = util.getClass( BELIEF_CLASS, BELIEF_JAR ); 101 assertNotNull( "getClass( "+BELIEF_CLASS+" ) returned null.", c ); 102 assertEquals( "getClass( "+BELIEF_CLASS+" ) returned the wrong class.", 103 BELIEF_CLASS, c.getName() ); 104 } 105 106 107 public void testCreateObject1() 108 { 109 ClassUtil util = startTest(); 110 111 Object o = util.createObject( BELIEF_CLASS, BELIEF_JAR ); 112 assertEquals( 113 "createObject( "+BELIEF_CLASS+", "+BELIEF_JAR+ 114 " ) did not instantiate the remote class.", 115 BELIEF_CLASS, o.getClass().getName() ); 116 } 117 118 119 121 122 protected ClassUtil startTest() 125 { 126 ClassUtil util = ClassUtil.getInstance(); 127 util.flush(); 128 return util; 129 } 130 } 131 | Popular Tags |