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

net.sourceforge.jtds.jdbc

## Class DriverUnitTest

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

-     public class DriverUnitTest
      extends UnitTestBase

  Unit tests for the `Driver` class.
  Version:
    $Id: DriverUnitTest.java,v 1.20 2007-07-08 18:08:54 bheineman Exp $
  Author:
    David D. Kilzer

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `private static class` | `DriverUnitTest.ParseURLTest`
    `static class` | `DriverUnitTest.Test_Driver_getPropertyInfo` Class used to test `Driver.getPropertyInfo(String, Properties)`.
    `static class` | `DriverUnitTest.Test_Driver_setupConnectProperties` Class used to test `Driver.setupConnectProperties(String, java.util.Properties)`.

  - ### Field Summary

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

      `con, props`

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addParseURLCorrectTests(TestSuite suite)` Creates tests for passing all variants of correct URLs.
    `private static java.util.Map<java.lang.String,java.util.Properties>` | `generateAllURLVariants(java.lang.String[] serverTypes, java.lang.String[] hosts, java.lang.String[] ports, java.lang.String[] databases, java.lang.String[][][] properties)`
    `private static java.util.Properties` | `invokeDriverParseURL(java.lang.String url, java.util.Properties prop)`
    `private void` | `loadDriverPropertyInfoMap(java.util.Map driverPropertyInfoMap)` Retrieve the `DriverPropertyInfo` array from `Driver.getPropertyInfo(String, Properties)` and convert it into a `Map` using the `name` property for the keys.
    `static Test` | `suite()` Construct a test suite for this class.
    `void` | `test_getPropertyInfo_Choices()` Tests that the `DriverPropertyInfo` array returned from `Driver.getPropertyInfo(String, Properties)` contains the correct `choices` value on each of the objects.
    `void` | `test_getPropertyInfo_MatchesMessagesProperties()` Tests that the `DriverPropertyInfo` array returned from `Driver.getPropertyInfo(String, Properties)` matches the list of properties defined in `Messages.properties`.
    `void` | `test_getPropertyInfo_Required()` Tests that the `DriverPropertyInfo` array returned from `Driver.getPropertyInfo(String, Properties)` contains the correct `required` value on each of the objects.
    `void` | `test_getPropertyInfo_ThrowsSQLExceptionWithNonNullProperties()` Tests that passing in a non-null properties argument to `Driver.getPropertyInfo(String, Properties)` causes the url to be parsed, which then throws a `SQLException`.
    `void` | `test_getPropertyInfo_ThrowsSQLExceptionWithNullProperties()` Tests that passing in a null properties argument to `Driver.getPropertyInfo(String, Properties)` causes the url to be parsed, which then throws a `SQLException`.
    `void` | `testDriverVersion()` Test to ensure that the version reported by the driver matches the JAR file's name.

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

      `assertEquals, invokeConstructor, invokeGetInstanceField, invokeInstanceMethod, invokeSetInstanceField, invokeStaticMethod, ucFirst`

    - ### 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

    - #### DriverUnitTest

          public DriverUnitTest(java.lang.String name)

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

  - ### Method Detail

    - #### suite

          public static Test suite()

      Construct a test suite for this class.

      The test suite includes the tests in this class, and adds tests from `DefaultPropertiesTestLibrary` after creating anonymous `DefaultPropertiesTester` objects.
      Returns:
        The test suite to run.

    - #### testDriverVersion

          public void testDriverVersion()
                                 throws java.lang.Exception

      Test to ensure that the version reported by the driver matches the JAR file's name.
      Throws:
        `java.lang.Exception`

    - #### test_getPropertyInfo_ThrowsSQLExceptionWithNullProperties

          public void test_getPropertyInfo_ThrowsSQLExceptionWithNullProperties()

      Tests that passing in a null properties argument to `Driver.getPropertyInfo(String, Properties)` causes the url to be parsed, which then throws a `SQLException`.

    - #### test_getPropertyInfo_ThrowsSQLExceptionWithNonNullProperties

          public void test_getPropertyInfo_ThrowsSQLExceptionWithNonNullProperties()

      Tests that passing in a non-null properties argument to `Driver.getPropertyInfo(String, Properties)` causes the url to be parsed, which then throws a `SQLException`.

    - #### test_getPropertyInfo_MatchesMessagesProperties

          public void test_getPropertyInfo_MatchesMessagesProperties()

      Tests that the `DriverPropertyInfo` array returned from `Driver.getPropertyInfo(String, Properties)` matches the list of properties defined in `Messages.properties`.

    - #### test_getPropertyInfo_Choices

          public void test_getPropertyInfo_Choices()

      Tests that the `DriverPropertyInfo` array returned from `Driver.getPropertyInfo(String, Properties)` contains the correct `choices` value on each of the objects.

    - #### test_getPropertyInfo_Required

          public void test_getPropertyInfo_Required()

      Tests that the `DriverPropertyInfo` array returned from `Driver.getPropertyInfo(String, Properties)` contains the correct `required` value on each of the objects.

    - #### loadDriverPropertyInfoMap

          private void loadDriverPropertyInfoMap(java.util.Map driverPropertyInfoMap)

      Retrieve the `DriverPropertyInfo` array from `Driver.getPropertyInfo(String, Properties)` and convert it into a `Map` using the `name` property for the keys.
      Parameters:
        `driverPropertyInfoMap` - The map of `DriverPropertyInfo` objects to be populated.

    - #### addParseURLCorrectTests

          public static void addParseURLCorrectTests(TestSuite suite)

      Creates tests for passing all variants of correct URLs. `Driver.parseURL(String, Properties)`

    - #### generateAllURLVariants

          private static java.util.Map<java.lang.String,java.util.Properties> generateAllURLVariants(java.lang.String[] serverTypes,
                                                                                    java.lang.String[] hosts,
                                                                                    java.lang.String[] ports,
                                                                                    java.lang.String[] databases,
                                                                                    java.lang.String[][][] properties)

    - #### invokeDriverParseURL

          private static java.util.Properties invokeDriverParseURL(java.lang.String url,
                                                  java.util.Properties prop)

Generated on June 8 2013