UnitTestBase (jTDS API)
Keywords: net.sourceforge.jtds.test.UnitTestBase class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.jtds.test
Class UnitTestBase

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              net.sourceforge.jtds.test.UnitTestBase

All Implemented Interfaces:
  junit.framework.Test

Direct Known Subclasses:
  ConnectionJDBC2UnitTest, DefaultPropertiesUnitTest, DriverUnitTest, JtdsDataSourceUnitTest, JtdsDataSourceUnitTest.Test_JtdsDataSource_getConnection, JtdsObjectFactoryUnitTest, MessagesPropertiesUnitTest, MessagesPropertiesUnitTest.TestDescriptionHasProperty, MessagesPropertiesUnitTest.TestPropertyHasDescription, NamedPipeUnitTest, SupportUnitTest

public abstract class UnitTestBase
extends junit.framework.TestCase

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 junit.framework.TestCase
``

Constructor Summary
`UnitTestBase(java.lang.String name)` Constructor.

Method Summary
`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 junit.framework.TestCase
`countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString`

Methods inherited from class junit.framework.Assert
`assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Generated on December 30 2009