/external/apache-harmony/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverPropertyInfoTest.java

https://gitlab.com/brian0218/rk3288_r-box_android4.4.2_sdk · Java · 107 lines · 45 code · 31 blank · 31 comment · 0 complexity · 8e9f1a0e5eaffaefd08bb7d9f8dc37ed MD5 · raw file

  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. package org.apache.harmony.sql.tests.java.sql;
  18. import java.sql.DriverPropertyInfo;
  19. import java.util.Arrays;
  20. import junit.framework.TestCase;
  21. /**
  22. * JUnit Testcase for the java.sql.DriverPropertyInfo class
  23. *
  24. */
  25. public class DriverPropertyInfoTest extends TestCase {
  26. /*
  27. * Public statics test
  28. */
  29. public void testPublicStatics() {
  30. } // end method testPublicStatics
  31. /*
  32. * Constructor test
  33. */
  34. public void testDriverPropertyInfoStringString() {
  35. DriverPropertyInfo aDriverPropertyInfo = new DriverPropertyInfo(
  36. validName, validValue);
  37. assertNotNull(aDriverPropertyInfo);
  38. aDriverPropertyInfo = new DriverPropertyInfo(null, null);
  39. } // end method testDriverPropertyInfoStringString
  40. /*
  41. * Public fields test
  42. */
  43. static String validName = "testname";
  44. static String validValue = "testvalue";
  45. static String[] updateChoices = { "Choice1", "Choice2", "Choice3" };
  46. static String updateValue = "updateValue";
  47. static boolean updateRequired = true;
  48. static String updateDescription = "update description";
  49. static String updateName = "updateName";
  50. public void testPublicFields() {
  51. // Constructor here...
  52. DriverPropertyInfo aDriverPropertyInfo = new DriverPropertyInfo(
  53. validName, validValue);
  54. assertTrue(Arrays.equals(testChoices, aDriverPropertyInfo.choices));
  55. assertEquals(testValue, aDriverPropertyInfo.value);
  56. assertEquals(testRequired, aDriverPropertyInfo.required);
  57. assertEquals(testDescription, aDriverPropertyInfo.description);
  58. assertEquals(testName, aDriverPropertyInfo.name);
  59. aDriverPropertyInfo.choices = updateChoices;
  60. aDriverPropertyInfo.value = updateValue;
  61. aDriverPropertyInfo.required = updateRequired;
  62. aDriverPropertyInfo.description = updateDescription;
  63. aDriverPropertyInfo.name = updateName;
  64. assertTrue(Arrays.equals(updateChoices, aDriverPropertyInfo.choices));
  65. assertEquals(updateValue, aDriverPropertyInfo.value);
  66. assertEquals(updateRequired, aDriverPropertyInfo.required);
  67. assertEquals(updateDescription, aDriverPropertyInfo.description);
  68. assertEquals(updateName, aDriverPropertyInfo.name);
  69. } // end method testPublicFields
  70. // Default values...
  71. static String[] testChoices = null;
  72. static java.lang.String testValue = validValue;
  73. static boolean testRequired = false;
  74. static java.lang.String testDescription = null;
  75. static java.lang.String testName = validName;
  76. } // end class DriverPropertyInfoTest