Home | History | Annotate | Download | only in sql
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 package org.apache.harmony.sql.tests.java.sql;
     19 
     20 import java.sql.DriverPropertyInfo;
     21 import java.util.Arrays;
     22 
     23 import junit.framework.TestCase;
     24 
     25 /**
     26  * JUnit Testcase for the java.sql.DriverPropertyInfo class
     27  */
     28 
     29 public class DriverPropertyInfoTest extends TestCase {
     30 
     31     /*
     32      * Public statics test
     33      */
     34     public void testPublicStatics() {
     35 
     36     } // end method testPublicStatics
     37 
     38     /*
     39      * Constructor test
     40      */
     41     public void testDriverPropertyInfoStringString() {
     42 
     43         DriverPropertyInfo aDriverPropertyInfo = new DriverPropertyInfo(
     44                 validName, validValue);
     45 
     46         assertNotNull(aDriverPropertyInfo);
     47 
     48         aDriverPropertyInfo = new DriverPropertyInfo(null, null);
     49 
     50     } // end method testDriverPropertyInfoStringString
     51 
     52     /*
     53      * Public fields test
     54      */
     55     static String validName = "testname";
     56 
     57     static String validValue = "testvalue";
     58 
     59     static String[] updateChoices = { "Choice1", "Choice2", "Choice3" };
     60 
     61     static String updateValue = "updateValue";
     62 
     63     static boolean updateRequired = true;
     64 
     65     static String updateDescription = "update description";
     66 
     67     static String updateName = "updateName";
     68 
     69     public void testPublicFields() {
     70 
     71         // Constructor here...
     72         DriverPropertyInfo aDriverPropertyInfo = new DriverPropertyInfo(
     73                 validName, validValue);
     74 
     75         assertTrue(Arrays.equals(testChoices, aDriverPropertyInfo.choices));
     76         assertEquals(testValue, aDriverPropertyInfo.value);
     77         assertEquals(testRequired, aDriverPropertyInfo.required);
     78         assertEquals(testDescription, aDriverPropertyInfo.description);
     79         assertEquals(testName, aDriverPropertyInfo.name);
     80 
     81         aDriverPropertyInfo.choices = updateChoices;
     82         aDriverPropertyInfo.value = updateValue;
     83         aDriverPropertyInfo.required = updateRequired;
     84         aDriverPropertyInfo.description = updateDescription;
     85         aDriverPropertyInfo.name = updateName;
     86 
     87         assertTrue(Arrays.equals(updateChoices, aDriverPropertyInfo.choices));
     88         assertEquals(updateValue, aDriverPropertyInfo.value);
     89         assertEquals(updateRequired, aDriverPropertyInfo.required);
     90         assertEquals(updateDescription, aDriverPropertyInfo.description);
     91         assertEquals(updateName, aDriverPropertyInfo.name);
     92 
     93     } // end method testPublicFields
     94 
     95     // Default values...
     96     static String[] testChoices = null;
     97 
     98     static java.lang.String testValue = validValue;
     99 
    100     static boolean testRequired = false;
    101 
    102     static java.lang.String testDescription = null;
    103 
    104     static java.lang.String testName = validName;
    105 
    106 } // end class DriverPropertyInfoTest
    107