UnitTestBase (jTDS API)
Date: 2013-06-08

net.sourceforge.jtds.jdbc

## Class UnitTestBase

- java.lang.Object
- - TestCase
  - - net.sourceforge.jtds.jdbc.TestBase
    - - net.sourceforge.jtds.jdbc.DatabaseTestCase
      - - net.sourceforge.jtds.jdbc.UnitTestBase

- Direct Known Subclasses:
    ConnectionTest, DefaultPropertiesUnitTest, DriverUnitTest, JtdsDataSourceTest, JtdsObjectFactoryTest, MessagesPropertiesUnitTest, MessagesPropertiesUnitTest.TestDescriptionHasProperty, MessagesPropertiesUnitTest.TestPropertyHasDescription, NamedPipeUnitTest, SupportUnitTest

      public abstract class UnitTestBase
      extends DatabaseTestCase

  Base class for unit tests which do not connect to a database.
  Version:
    $Id: UnitTestBase.java,v 1.12 2005-12-22 17:24:07 ddkilzer Exp $
  Author:
    David D. Kilzer

- - ### Field Summary

    - ### Fields inherited from class net.sourceforge.jtds.jdbc.TestBase

      `con, props`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UnitTestBase(java.lang.String name)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `assertEquals(java.lang.String message, java.lang.Object[] expected, java.lang.Object[] actual)` Compare two arrays element-by-element.
    `private void` | `failNotEquals(java.lang.String message, java.lang.Object[] expected, java.lang.Object[] actual)`
    `private java.lang.String` | `format(java.lang.Object[] object)` Format an `Object[]` object to a `String`.
    `static java.lang.Object` | `invokeConstructor(java.lang.Class klass, java.lang.Class[] classes, java.lang.Object[] objects)` Invoke a constructor on a class using reflection.
    `static java.lang.Object` | `invokeGetInstanceField(java.lang.Object instance, java.lang.String fieldName)` Get the value of an instance field on an object using reflection.
    `static java.lang.Object` | `invokeInstanceMethod(java.lang.Object instance, java.lang.String methodName, java.lang.Class[] classes, java.lang.Object[] objects)` Invoke an instance method on an object using reflection.
    `static void` | `invokeSetInstanceField(java.lang.Object instance, java.lang.String fieldName, java.lang.Object fieldValue)` Set the value of an instance field on an object using reflection.
    `static java.lang.Object` | `invokeStaticMethod(java.lang.Class klass, java.lang.String methodName, java.lang.Class[] classes, java.lang.Object[] objects)` Invoke a static method on a class using reflection.
    `protected static java.lang.String` | `ucFirst(java.lang.String s)` Changes the first character of a string to uppercase.

    - ### Methods inherited from class net.sourceforge.jtds.jdbc.DatabaseTestCase

      `compareBytes, getLongString, getLongString, getType, getTypemap`

    - ### Methods inherited from class net.sourceforge.jtds.jdbc.TestBase

      `compareInputStreams, compareReaders, connect, dropDatabase, dropFunction, dropProcedure, dropTable, dropTrigger, dropType, dropView, dump, dump, dumpAll, dumpKeys, dumpRow, dumpRow, getConnection, getConnection, makeObjects, makeTestTables, setUp, tearDown`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UnitTestBase

          public UnitTestBase(java.lang.String name)

      Constructor.
      Parameters:
        `name` - The name of the test.

  - ### Method Detail

    - #### invokeConstructor

          public static java.lang.Object invokeConstructor(java.lang.Class klass,
                                           java.lang.Class[] classes,
                                           java.lang.Object[] objects)

      Invoke a constructor on a class using reflection.
      Parameters:
        `klass` - The class.
        `classes` - The classes in the parameter list.
        `objects` - The objects to be used as parameters.
      Returns:
        The object constructed.

    - #### invokeGetInstanceField

          public static java.lang.Object invokeGetInstanceField(java.lang.Object instance,
                                                java.lang.String fieldName)

      Get the value of an instance field on an object using reflection.
      Parameters:
        `instance` - The instance of the object.
        `fieldName` - The name of the field.
      Returns:
        The object returned by getting the field.

    - #### invokeSetInstanceField

          public static void invokeSetInstanceField(java.lang.Object instance,
                                    java.lang.String fieldName,
                                    java.lang.Object fieldValue)

      Set the value of an instance field on an object using reflection.
      Parameters:
        `instance` - The instance of the object.
        `fieldName` - The name of the field.
        `fieldValue` - The value to set the field to.

    - #### invokeInstanceMethod

          public static java.lang.Object invokeInstanceMethod(java.lang.Object instance,
                                              java.lang.String methodName,
                                              java.lang.Class[] classes,
                                              java.lang.Object[] objects)

      Invoke an instance method on an object using reflection.
      Parameters:
        `instance` - The instance of the object.
        `methodName` - The name of the method.
        `classes` - The classes in the parameter list.
        `objects` - The objects to be used as parameters.
      Returns:
        The object returned by invoking the method.

    - #### invokeStaticMethod

          public static java.lang.Object invokeStaticMethod(java.lang.Class klass,
                                            java.lang.String methodName,
                                            java.lang.Class[] classes,
                                            java.lang.Object[] objects)

      Invoke a static method on a class using reflection.
      Parameters:
        `klass` - The class.
        `methodName` - The name of the method.
        `classes` - The classes in the parameter list.
        `objects` - The objects to be used as parameters.
      Returns:
        The object returned by invoking the method.

    - #### assertEquals

          protected void assertEquals(java.lang.String message,
                          java.lang.Object[] expected,
                          java.lang.Object[] actual)

      Compare two arrays element-by-element.

      The default JUnit `Assert#assertEquals(String, Object, Object)` method does not handle them properly.
      Parameters:
        `message` - The message to print upon failure.
        `expected` - The expected value.
        `actual` - The actual value.

    - #### failNotEquals

          private void failNotEquals(java.lang.String message,
                           java.lang.Object[] expected,
                           java.lang.Object[] actual)

      See Also:
        `Assert#failNotEquals(java.lang.String, java.lang.Object, java.lang.Object)`

    - #### format

          private java.lang.String format(java.lang.Object[] object)

      Format an `Object[]` object to a `String`.
      Parameters:
        `object` - The object to be formatted.
      Returns:
        Formatted string representing the object.

    - #### ucFirst

          protected static java.lang.String ucFirst(java.lang.String s)

      Changes the first character of a string to uppercase.
      Parameters:
        `s` - The string to be processed.
      Returns:
        The value of `s` if it is `null` or zero length, else the string with the first character changed to uppercase.

Generated on June 8 2013