net.sourceforge.jtds.jdbc
Class DriverUnitTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bynet.sourceforge.jtds.jdbc.TestBase
              extended bynet.sourceforge.jtds.jdbc.DatabaseTestCase
                  extended bynet.sourceforge.jtds.jdbc.UnitTestBase
                      extended bynet.sourceforge.jtds.jdbc.DriverUnitTest
All Implemented Interfaces:
junit.framework.Test

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
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.DatabaseTestCase
 
Fields inherited from class net.sourceforge.jtds.jdbc.TestBase
con, props
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
DriverUnitTest(java.lang.String name)
          Constructor.
 
Method Summary
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 junit.framework.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.
 
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 junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, 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

DriverUnitTest

public DriverUnitTest(java.lang.String name)
Constructor.

Parameters:
name - The name of the test.
Method Detail

suite

public static junit.framework.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.

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.

invokeDriverParseURL

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


Generated on October 27 2012