| net.sourceforge.jtds.test.UnitTestBase
All known Subclasses: net.sourceforge.jtds.test.NamedPipeUnitTest, net.sourceforge.jtds.test.JtdsDataSourceUnitTest, net.sourceforge.jtds.test.DefaultPropertiesUnitTest, net.sourceforge.jtds.test.MessagesPropertiesUnitTest, net.sourceforge.jtds.test.SupportUnitTest, net.sourceforge.jtds.test.DriverUnitTest, net.sourceforge.jtds.test.JtdsObjectFactoryUnitTest, net.sourceforge.jtds.test.ConnectionJDBC2UnitTest,
UnitTestBase | abstract public class UnitTestBase extends TestCase (Code) | | Base class for unit tests which do not connect to a database.
author: David D. Kilzer version: $Id: UnitTestBase.java,v 1.12 2005/12/22 17:24:07 ddkilzer Exp $ |
Method Summary | |
protected void | assertEquals(String message, Object[] expected, Object[] actual) Compare two arrays element-by-element. | public static Object | invokeConstructor(Class klass, Class[] classes, Object[] objects) Invoke a constructor on a class using reflection.
Parameters: klass - The class. Parameters: classes - The classes in the parameter list. Parameters: objects - The objects to be used as parameters. | public static Object | invokeGetInstanceField(Object instance, String fieldName) Get the value of an instance field on an object using reflection.
Parameters: instance - The instance of the object. Parameters: fieldName - The name of the field. | public static Object | invokeInstanceMethod(Object instance, String methodName, Class[] classes, Object[] objects) Invoke an instance method on an object using reflection.
Parameters: instance - The instance of the object. Parameters: methodName - The name of the method. Parameters: classes - The classes in the parameter list. Parameters: objects - The objects to be used as parameters. | public static void | invokeSetInstanceField(Object instance, String fieldName, Object fieldValue) Set the value of an instance field on an object using reflection. | public static Object | invokeStaticMethod(Class klass, String methodName, Class[] classes, Object[] objects) Invoke a static method on a class using reflection.
Parameters: klass - The class. Parameters: methodName - The name of the method. Parameters: classes - The classes in the parameter list. Parameters: objects - The objects to be used as parameters. | protected static String | ucFirst(String s) Changes the first character of a string to uppercase.
Parameters: s - The string to be processed. |
UnitTestBase | public UnitTestBase(String name)(Code) | | Constructor.
Parameters: name - The name of the test. |
assertEquals | protected void assertEquals(String message, Object[] expected, Object[] actual)(Code) | | Compare two arrays element-by-element.
The default JUnit
Assert.assertEquals(StringObjectObject) method
does not handle them properly.
Parameters: message - The message to print upon failure. Parameters: expected - The expected value. Parameters: actual - The actual value. |
invokeConstructor | public static Object invokeConstructor(Class klass, Class[] classes, Object[] objects)(Code) | | Invoke a constructor on a class using reflection.
Parameters: klass - The class. Parameters: classes - The classes in the parameter list. Parameters: objects - The objects to be used as parameters. The object constructed. |
invokeGetInstanceField | public static Object invokeGetInstanceField(Object instance, String fieldName)(Code) | | Get the value of an instance field on an object using reflection.
Parameters: instance - The instance of the object. Parameters: fieldName - The name of the field. The object returned by getting the field. |
invokeInstanceMethod | public static Object invokeInstanceMethod(Object instance, String methodName, Class[] classes, Object[] objects)(Code) | | Invoke an instance method on an object using reflection.
Parameters: instance - The instance of the object. Parameters: methodName - The name of the method. Parameters: classes - The classes in the parameter list. Parameters: objects - The objects to be used as parameters. The object returned by invoking the method. |
invokeSetInstanceField | public static void invokeSetInstanceField(Object instance, String fieldName, Object fieldValue)(Code) | | Set the value of an instance field on an object using reflection.
Parameters: instance - The instance of the object. Parameters: fieldName - The name of the field. Parameters: fieldValue - The value to set the field to. |
invokeStaticMethod | public static Object invokeStaticMethod(Class klass, String methodName, Class[] classes, Object[] objects)(Code) | | Invoke a static method on a class using reflection.
Parameters: klass - The class. Parameters: methodName - The name of the method. Parameters: classes - The classes in the parameter list. Parameters: objects - The objects to be used as parameters. The object returned by invoking the method. |
ucFirst | protected static String ucFirst(String s)(Code) | | Changes the first character of a string to uppercase.
Parameters: s - The string to be processed. The value of s if it is null or zero length,else the string with the first character changed to uppercase. |
|
|