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

https://gitlab.com/brian0218/rk3288_r-box_android4.4.2_sdk · Java · 985 lines · 757 code · 56 blank · 172 comment · 0 complexity · 5892643bc2191af459a2ecf1cbe7d676 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.SQLNonTransientConnectionException;
  19. import junit.framework.TestCase;
  20. import org.apache.harmony.testframework.serialization.SerializationTest;
  21. public class SQLNonTransientConnectionExceptionTest extends TestCase {
  22. private SQLNonTransientConnectionException sQLNonTransientConnectionException;
  23. protected void setUp() throws Exception {
  24. sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  25. "MYTESTSTRING", "MYTESTSTRING", 1, new Exception("MYTHROWABLE"));
  26. }
  27. protected void tearDown() throws Exception {
  28. sQLNonTransientConnectionException = null;
  29. }
  30. /**
  31. * @test java.sql.SQLNonTransientConnectionException(String)
  32. */
  33. public void test_Constructor_LString() {
  34. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  35. "MYTESTSTRING");
  36. assertNotNull(sQLNonTransientConnectionException);
  37. assertNull(
  38. "The SQLState of SQLNonTransientConnectionException should be null",
  39. sQLNonTransientConnectionException.getSQLState());
  40. assertEquals(
  41. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  42. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  43. assertEquals(
  44. "The error code of SQLNonTransientConnectionException should be 0",
  45. sQLNonTransientConnectionException.getErrorCode(), 0);
  46. }
  47. /**
  48. * @test java.sql.SQLNonTransientConnectionException(String)
  49. */
  50. public void test_Constructor_LString_1() {
  51. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  52. (String) null);
  53. assertNotNull(sQLNonTransientConnectionException);
  54. assertNull(
  55. "The SQLState of SQLNonTransientConnectionException should be null",
  56. sQLNonTransientConnectionException.getSQLState());
  57. assertNull(
  58. "The reason of SQLNonTransientConnectionException should be null",
  59. sQLNonTransientConnectionException.getMessage());
  60. assertEquals(
  61. "The error code of SQLNonTransientConnectionException should be 0",
  62. sQLNonTransientConnectionException.getErrorCode(), 0);
  63. }
  64. /**
  65. * @test java.sql.SQLNonTransientConnectionException(String, String)
  66. */
  67. public void test_Constructor_LStringLString() {
  68. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  69. "MYTESTSTRING1", "MYTESTSTRING2");
  70. assertNotNull(sQLNonTransientConnectionException);
  71. assertEquals(
  72. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  73. "MYTESTSTRING2", sQLNonTransientConnectionException
  74. .getSQLState());
  75. assertEquals(
  76. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  77. "MYTESTSTRING1", sQLNonTransientConnectionException
  78. .getMessage());
  79. assertEquals(
  80. "The error code of SQLNonTransientConnectionException should be 0",
  81. sQLNonTransientConnectionException.getErrorCode(), 0);
  82. }
  83. /**
  84. * @test java.sql.SQLNonTransientConnectionException(String, String)
  85. */
  86. public void test_Constructor_LStringLString_1() {
  87. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  88. "MYTESTSTRING", (String) null);
  89. assertNotNull(sQLNonTransientConnectionException);
  90. assertNull(
  91. "The SQLState of SQLNonTransientConnectionException should be null",
  92. sQLNonTransientConnectionException.getSQLState());
  93. assertEquals(
  94. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  95. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  96. assertEquals(
  97. "The error code of SQLNonTransientConnectionException should be 0",
  98. sQLNonTransientConnectionException.getErrorCode(), 0);
  99. }
  100. /**
  101. * @test java.sql.SQLNonTransientConnectionException(String, String)
  102. */
  103. public void test_Constructor_LStringLString_2() {
  104. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  105. null, "MYTESTSTRING");
  106. assertNotNull(sQLNonTransientConnectionException);
  107. assertEquals(
  108. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  109. "MYTESTSTRING", sQLNonTransientConnectionException
  110. .getSQLState());
  111. assertNull(
  112. "The reason of SQLNonTransientConnectionException should be null",
  113. sQLNonTransientConnectionException.getMessage());
  114. assertEquals(
  115. "The error code of SQLNonTransientConnectionException should be 0",
  116. sQLNonTransientConnectionException.getErrorCode(), 0);
  117. }
  118. /**
  119. * @test java.sql.SQLNonTransientConnectionException(String, String)
  120. */
  121. public void test_Constructor_LStringLString_3() {
  122. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  123. (String) null, (String) null);
  124. assertNotNull(sQLNonTransientConnectionException);
  125. assertNull(
  126. "The SQLState of SQLNonTransientConnectionException should be null",
  127. sQLNonTransientConnectionException.getSQLState());
  128. assertNull(
  129. "The reason of SQLNonTransientConnectionException should be null",
  130. sQLNonTransientConnectionException.getMessage());
  131. assertEquals(
  132. "The error code of SQLNonTransientConnectionException should be 0",
  133. sQLNonTransientConnectionException.getErrorCode(), 0);
  134. }
  135. /**
  136. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  137. */
  138. public void test_Constructor_LStringLStringI() {
  139. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  140. "MYTESTSTRING1", "MYTESTSTRING2", 1);
  141. assertNotNull(sQLNonTransientConnectionException);
  142. assertEquals(
  143. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  144. "MYTESTSTRING2", sQLNonTransientConnectionException
  145. .getSQLState());
  146. assertEquals(
  147. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  148. "MYTESTSTRING1", sQLNonTransientConnectionException
  149. .getMessage());
  150. assertEquals(
  151. "The error code of SQLNonTransientConnectionException should be 1",
  152. sQLNonTransientConnectionException.getErrorCode(), 1);
  153. }
  154. /**
  155. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  156. */
  157. public void test_Constructor_LStringLStringI_1() {
  158. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  159. "MYTESTSTRING1", "MYTESTSTRING2", 0);
  160. assertNotNull(sQLNonTransientConnectionException);
  161. assertEquals(
  162. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  163. "MYTESTSTRING2", sQLNonTransientConnectionException
  164. .getSQLState());
  165. assertEquals(
  166. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  167. "MYTESTSTRING1", sQLNonTransientConnectionException
  168. .getMessage());
  169. assertEquals(
  170. "The error code of SQLNonTransientConnectionException should be 0",
  171. sQLNonTransientConnectionException.getErrorCode(), 0);
  172. }
  173. /**
  174. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  175. */
  176. public void test_Constructor_LStringLStringI_2() {
  177. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  178. "MYTESTSTRING1", "MYTESTSTRING2", -1);
  179. assertNotNull(sQLNonTransientConnectionException);
  180. assertEquals(
  181. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  182. "MYTESTSTRING2", sQLNonTransientConnectionException
  183. .getSQLState());
  184. assertEquals(
  185. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  186. "MYTESTSTRING1", sQLNonTransientConnectionException
  187. .getMessage());
  188. assertEquals(
  189. "The error code of SQLNonTransientConnectionException should be -1",
  190. sQLNonTransientConnectionException.getErrorCode(), -1);
  191. }
  192. /**
  193. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  194. */
  195. public void test_Constructor_LStringLStringI_3() {
  196. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  197. "MYTESTSTRING", null, 1);
  198. assertNotNull(sQLNonTransientConnectionException);
  199. assertNull(
  200. "The SQLState of SQLNonTransientConnectionException should be null",
  201. sQLNonTransientConnectionException.getSQLState());
  202. assertEquals(
  203. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  204. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  205. assertEquals(
  206. "The error code of SQLNonTransientConnectionException should be 1",
  207. sQLNonTransientConnectionException.getErrorCode(), 1);
  208. }
  209. /**
  210. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  211. */
  212. public void test_Constructor_LStringLStringI_4() {
  213. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  214. "MYTESTSTRING", null, 0);
  215. assertNotNull(sQLNonTransientConnectionException);
  216. assertNull(
  217. "The SQLState of SQLNonTransientConnectionException should be null",
  218. sQLNonTransientConnectionException.getSQLState());
  219. assertEquals(
  220. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  221. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  222. assertEquals(
  223. "The error code of SQLNonTransientConnectionException should be 0",
  224. sQLNonTransientConnectionException.getErrorCode(), 0);
  225. }
  226. /**
  227. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  228. */
  229. public void test_Constructor_LStringLStringI_5() {
  230. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  231. "MYTESTSTRING", null, -1);
  232. assertNotNull(sQLNonTransientConnectionException);
  233. assertNull(
  234. "The SQLState of SQLNonTransientConnectionException should be null",
  235. sQLNonTransientConnectionException.getSQLState());
  236. assertEquals(
  237. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  238. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  239. assertEquals(
  240. "The error code of SQLNonTransientConnectionException should be -1",
  241. sQLNonTransientConnectionException.getErrorCode(), -1);
  242. }
  243. /**
  244. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  245. */
  246. public void test_Constructor_LStringLStringI_6() {
  247. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  248. null, "MYTESTSTRING", 1);
  249. assertNotNull(sQLNonTransientConnectionException);
  250. assertEquals(
  251. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  252. "MYTESTSTRING", sQLNonTransientConnectionException
  253. .getSQLState());
  254. assertNull(
  255. "The reason of SQLNonTransientConnectionException should be null",
  256. sQLNonTransientConnectionException.getMessage());
  257. assertEquals(
  258. "The error code of SQLNonTransientConnectionException should be 1",
  259. sQLNonTransientConnectionException.getErrorCode(), 1);
  260. }
  261. /**
  262. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  263. */
  264. public void test_Constructor_LStringLStringI_7() {
  265. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  266. null, "MYTESTSTRING", 0);
  267. assertNotNull(sQLNonTransientConnectionException);
  268. assertEquals(
  269. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  270. "MYTESTSTRING", sQLNonTransientConnectionException
  271. .getSQLState());
  272. assertNull(
  273. "The reason of SQLNonTransientConnectionException should be null",
  274. sQLNonTransientConnectionException.getMessage());
  275. assertEquals(
  276. "The error code of SQLNonTransientConnectionException should be 0",
  277. sQLNonTransientConnectionException.getErrorCode(), 0);
  278. }
  279. /**
  280. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  281. */
  282. public void test_Constructor_LStringLStringI_8() {
  283. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  284. null, "MYTESTSTRING", -1);
  285. assertNotNull(sQLNonTransientConnectionException);
  286. assertEquals(
  287. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  288. "MYTESTSTRING", sQLNonTransientConnectionException
  289. .getSQLState());
  290. assertNull(
  291. "The reason of SQLNonTransientConnectionException should be null",
  292. sQLNonTransientConnectionException.getMessage());
  293. assertEquals(
  294. "The error code of SQLNonTransientConnectionException should be -1",
  295. sQLNonTransientConnectionException.getErrorCode(), -1);
  296. }
  297. /**
  298. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  299. */
  300. public void test_Constructor_LStringLStringI_9() {
  301. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  302. null, null, 1);
  303. assertNotNull(sQLNonTransientConnectionException);
  304. assertNull(
  305. "The SQLState of SQLNonTransientConnectionException should be null",
  306. sQLNonTransientConnectionException.getSQLState());
  307. assertNull(
  308. "The reason of SQLNonTransientConnectionException should be null",
  309. sQLNonTransientConnectionException.getMessage());
  310. assertEquals(
  311. "The error code of SQLNonTransientConnectionException should be 1",
  312. sQLNonTransientConnectionException.getErrorCode(), 1);
  313. }
  314. /**
  315. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  316. */
  317. public void test_Constructor_LStringLStringI_10() {
  318. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  319. null, null, 0);
  320. assertNotNull(sQLNonTransientConnectionException);
  321. assertNull(
  322. "The SQLState of SQLNonTransientConnectionException should be null",
  323. sQLNonTransientConnectionException.getSQLState());
  324. assertNull(
  325. "The reason of SQLNonTransientConnectionException should be null",
  326. sQLNonTransientConnectionException.getMessage());
  327. assertEquals(
  328. "The error code of SQLNonTransientConnectionException should be 0",
  329. sQLNonTransientConnectionException.getErrorCode(), 0);
  330. }
  331. /**
  332. * @test java.sql.SQLNonTransientConnectionException(String, String, int)
  333. */
  334. public void test_Constructor_LStringLStringI_11() {
  335. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  336. null, null, -1);
  337. assertNotNull(sQLNonTransientConnectionException);
  338. assertNull(
  339. "The SQLState of SQLNonTransientConnectionException should be null",
  340. sQLNonTransientConnectionException.getSQLState());
  341. assertNull(
  342. "The reason of SQLNonTransientConnectionException should be null",
  343. sQLNonTransientConnectionException.getMessage());
  344. assertEquals(
  345. "The error code of SQLNonTransientConnectionException should be -1",
  346. sQLNonTransientConnectionException.getErrorCode(), -1);
  347. }
  348. /**
  349. * @test java.sql.SQLNonTransientConnectionException(Throwable)
  350. */
  351. public void test_Constructor_LThrowable() {
  352. Throwable cause = new Exception("MYTHROWABLE");
  353. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  354. cause);
  355. assertNotNull(sQLNonTransientConnectionException);
  356. assertEquals(
  357. "The reason of SQLNonTransientConnectionException should be equals to cause.toString()",
  358. "java.lang.Exception: MYTHROWABLE",
  359. sQLNonTransientConnectionException.getMessage());
  360. assertNull(
  361. "The SQLState of SQLNonTransientConnectionException should be null",
  362. sQLNonTransientConnectionException.getSQLState());
  363. assertEquals(
  364. "The error code of SQLNonTransientConnectionException should be 0",
  365. sQLNonTransientConnectionException.getErrorCode(), 0);
  366. assertEquals(
  367. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  368. cause, sQLNonTransientConnectionException.getCause());
  369. }
  370. /**
  371. * @test java.sql.SQLNonTransientConnectionException(Throwable)
  372. */
  373. public void test_Constructor_LThrowable_1() {
  374. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  375. (Throwable) null);
  376. assertNotNull(sQLNonTransientConnectionException);
  377. assertNull(
  378. "The SQLState of SQLNonTransientConnectionException should be null",
  379. sQLNonTransientConnectionException.getSQLState());
  380. assertNull(
  381. "The reason of SQLNonTransientConnectionException should be null",
  382. sQLNonTransientConnectionException.getMessage());
  383. assertEquals(
  384. "The error code of SQLNonTransientConnectionException should be 0",
  385. sQLNonTransientConnectionException.getErrorCode(), 0);
  386. assertNull(
  387. "The cause of SQLNonTransientConnectionException should be null",
  388. sQLNonTransientConnectionException.getCause());
  389. }
  390. /**
  391. * @test java.sql.SQLNonTransientConnectionException(String, Throwable)
  392. */
  393. public void test_Constructor_LStringLThrowable() {
  394. Throwable cause = new Exception("MYTHROWABLE");
  395. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  396. "MYTESTSTRING", cause);
  397. assertNotNull(sQLNonTransientConnectionException);
  398. assertEquals(
  399. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  400. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  401. assertNull(
  402. "The SQLState of SQLNonTransientConnectionException should be null",
  403. sQLNonTransientConnectionException.getSQLState());
  404. assertEquals(
  405. "The error code of SQLNonTransientConnectionException should be 0",
  406. sQLNonTransientConnectionException.getErrorCode(), 0);
  407. assertEquals(
  408. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  409. cause, sQLNonTransientConnectionException.getCause());
  410. }
  411. /**
  412. * @test java.sql.SQLNonTransientConnectionException(String, Throwable)
  413. */
  414. public void test_Constructor_LStringLThrowable_1() {
  415. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  416. "MYTESTSTRING", (Throwable) null);
  417. assertNotNull(sQLNonTransientConnectionException);
  418. assertEquals(
  419. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  420. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  421. assertNull(
  422. "The SQLState of SQLNonTransientConnectionException should be null",
  423. sQLNonTransientConnectionException.getSQLState());
  424. assertEquals(
  425. "The error code of SQLNonTransientConnectionException should be 0",
  426. sQLNonTransientConnectionException.getErrorCode(), 0);
  427. assertNull(
  428. "The cause of SQLNonTransientConnectionException should be null",
  429. sQLNonTransientConnectionException.getCause());
  430. }
  431. /**
  432. * @test java.sql.SQLNonTransientConnectionException(String, Throwable)
  433. */
  434. public void test_Constructor_LStringLThrowable_2() {
  435. Throwable cause = new Exception("MYTHROWABLE");
  436. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  437. null, cause);
  438. assertNotNull(sQLNonTransientConnectionException);
  439. assertNull(
  440. "The reason of SQLNonTransientConnectionException should be null",
  441. sQLNonTransientConnectionException.getMessage());
  442. assertNull(
  443. "The SQLState of SQLNonTransientConnectionException should be null",
  444. sQLNonTransientConnectionException.getSQLState());
  445. assertEquals(
  446. "The error code of SQLNonTransientConnectionException should be 0",
  447. sQLNonTransientConnectionException.getErrorCode(), 0);
  448. }
  449. /**
  450. * @test java.sql.SQLNonTransientConnectionException(String, Throwable)
  451. */
  452. public void test_Constructor_LStringLThrowable_3() {
  453. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  454. (String) null, (Throwable) null);
  455. assertNotNull(sQLNonTransientConnectionException);
  456. assertNull(
  457. "The SQLState of SQLNonTransientConnectionException should be null",
  458. sQLNonTransientConnectionException.getSQLState());
  459. assertNull(
  460. "The reason of SQLNonTransientConnectionException should be null",
  461. sQLNonTransientConnectionException.getMessage());
  462. assertEquals(
  463. "The error code of SQLNonTransientConnectionException should be 0",
  464. sQLNonTransientConnectionException.getErrorCode(), 0);
  465. assertNull(
  466. "The cause of SQLNonTransientConnectionException should be null",
  467. sQLNonTransientConnectionException.getCause());
  468. }
  469. /**
  470. * @test java.sql.SQLNonTransientConnectionException(String, String,
  471. * Throwable)
  472. */
  473. public void test_Constructor_LStringLStringLThrowable() {
  474. Throwable cause = new Exception("MYTHROWABLE");
  475. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  476. "MYTESTSTRING1", "MYTESTSTRING2", cause);
  477. assertNotNull(sQLNonTransientConnectionException);
  478. assertEquals(
  479. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  480. "MYTESTSTRING2", sQLNonTransientConnectionException
  481. .getSQLState());
  482. assertEquals(
  483. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  484. "MYTESTSTRING1", sQLNonTransientConnectionException
  485. .getMessage());
  486. assertEquals(
  487. "The error code of SQLNonTransientConnectionException should be 0",
  488. sQLNonTransientConnectionException.getErrorCode(), 0);
  489. assertEquals(
  490. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  491. cause, sQLNonTransientConnectionException.getCause());
  492. }
  493. /**
  494. * @test java.sql.SQLNonTransientConnectionException(String, String,
  495. * Throwable)
  496. */
  497. public void test_Constructor_LStringLStringLThrowable_1() {
  498. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  499. "MYTESTSTRING1", "MYTESTSTRING2", null);
  500. assertNotNull(sQLNonTransientConnectionException);
  501. assertEquals(
  502. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  503. "MYTESTSTRING2", sQLNonTransientConnectionException
  504. .getSQLState());
  505. assertEquals(
  506. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  507. "MYTESTSTRING1", sQLNonTransientConnectionException
  508. .getMessage());
  509. assertEquals(
  510. "The error code of SQLNonTransientConnectionException should be 0",
  511. sQLNonTransientConnectionException.getErrorCode(), 0);
  512. assertNull(
  513. "The cause of SQLNonTransientConnectionException should be null",
  514. sQLNonTransientConnectionException.getCause());
  515. }
  516. /**
  517. * @test java.sql.SQLNonTransientConnectionException(String, String,
  518. * Throwable)
  519. */
  520. public void test_Constructor_LStringLStringLThrowable_2() {
  521. Throwable cause = new Exception("MYTHROWABLE");
  522. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  523. "MYTESTSTRING", null, cause);
  524. assertNotNull(sQLNonTransientConnectionException);
  525. assertNull(
  526. "The SQLState of SQLNonTransientConnectionException should be null",
  527. sQLNonTransientConnectionException.getSQLState());
  528. assertEquals(
  529. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  530. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  531. assertEquals(
  532. "The error code of SQLNonTransientConnectionException should be 0",
  533. sQLNonTransientConnectionException.getErrorCode(), 0);
  534. assertEquals(
  535. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  536. cause, sQLNonTransientConnectionException.getCause());
  537. }
  538. /**
  539. * @test java.sql.SQLNonTransientConnectionException(String, String,
  540. * Throwable)
  541. */
  542. public void test_Constructor_LStringLStringLThrowable_3() {
  543. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  544. "MYTESTSTRING", null, null);
  545. assertNotNull(sQLNonTransientConnectionException);
  546. assertNull(
  547. "The SQLState of SQLNonTransientConnectionException should be null",
  548. sQLNonTransientConnectionException.getSQLState());
  549. assertEquals(
  550. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  551. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  552. assertEquals(
  553. "The error code of SQLNonTransientConnectionException should be 0",
  554. sQLNonTransientConnectionException.getErrorCode(), 0);
  555. assertNull(
  556. "The cause of SQLNonTransientConnectionException should be null",
  557. sQLNonTransientConnectionException.getCause());
  558. }
  559. /**
  560. * @test java.sql.SQLNonTransientConnectionException(String, String,
  561. * Throwable)
  562. */
  563. public void test_Constructor_LStringLStringLThrowable_4() {
  564. Throwable cause = new Exception("MYTHROWABLE");
  565. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  566. null, "MYTESTSTRING", cause);
  567. assertNotNull(sQLNonTransientConnectionException);
  568. assertEquals(
  569. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  570. "MYTESTSTRING", sQLNonTransientConnectionException
  571. .getSQLState());
  572. assertNull(
  573. "The reason of SQLNonTransientConnectionException should be null",
  574. sQLNonTransientConnectionException.getMessage());
  575. assertEquals(
  576. "The error code of SQLNonTransientConnectionException should be 0",
  577. sQLNonTransientConnectionException.getErrorCode(), 0);
  578. assertEquals(
  579. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  580. cause, sQLNonTransientConnectionException.getCause());
  581. }
  582. /**
  583. * @test java.sql.SQLNonTransientConnectionException(String, String,
  584. * Throwable)
  585. */
  586. public void test_Constructor_LStringLStringLThrowable_5() {
  587. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  588. null, "MYTESTSTRING", null);
  589. assertNotNull(sQLNonTransientConnectionException);
  590. assertEquals(
  591. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  592. "MYTESTSTRING", sQLNonTransientConnectionException
  593. .getSQLState());
  594. assertNull(
  595. "The reason of SQLNonTransientConnectionException should be null",
  596. sQLNonTransientConnectionException.getMessage());
  597. assertEquals(
  598. "The error code of SQLNonTransientConnectionException should be 0",
  599. sQLNonTransientConnectionException.getErrorCode(), 0);
  600. assertNull(
  601. "The cause of SQLNonTransientConnectionException should be null",
  602. sQLNonTransientConnectionException.getCause());
  603. }
  604. /**
  605. * @test java.sql.SQLNonTransientConnectionException(String, String,
  606. * Throwable)
  607. */
  608. public void test_Constructor_LStringLStringLThrowable_6() {
  609. Throwable cause = new Exception("MYTHROWABLE");
  610. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  611. null, null, cause);
  612. assertNotNull(sQLNonTransientConnectionException);
  613. assertNull(
  614. "The SQLState of SQLNonTransientConnectionException should be null",
  615. sQLNonTransientConnectionException.getSQLState());
  616. assertNull(
  617. "The reason of SQLNonTransientConnectionException should be null",
  618. sQLNonTransientConnectionException.getMessage());
  619. assertEquals(
  620. "The error code of SQLNonTransientConnectionException should be 0",
  621. sQLNonTransientConnectionException.getErrorCode(), 0);
  622. assertEquals(
  623. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  624. cause, sQLNonTransientConnectionException.getCause());
  625. }
  626. /**
  627. * @test java.sql.SQLNonTransientConnectionException(String, String,
  628. * Throwable)
  629. */
  630. public void test_Constructor_LStringLStringLThrowable_7() {
  631. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  632. null, null, null);
  633. assertNotNull(sQLNonTransientConnectionException);
  634. assertNull(
  635. "The SQLState of SQLNonTransientConnectionException should be null",
  636. sQLNonTransientConnectionException.getSQLState());
  637. assertNull(
  638. "The reason of SQLNonTransientConnectionException should be null",
  639. sQLNonTransientConnectionException.getMessage());
  640. assertEquals(
  641. "The error code of SQLNonTransientConnectionException should be 0",
  642. sQLNonTransientConnectionException.getErrorCode(), 0);
  643. assertNull(
  644. "The cause of SQLNonTransientConnectionException should be null",
  645. sQLNonTransientConnectionException.getCause());
  646. }
  647. /**
  648. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  649. * Throwable)
  650. */
  651. public void test_Constructor_LStringLStringILThrowable() {
  652. Throwable cause = new Exception("MYTHROWABLE");
  653. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  654. "MYTESTSTRING1", "MYTESTSTRING2", 1, cause);
  655. assertNotNull(sQLNonTransientConnectionException);
  656. assertEquals(
  657. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  658. "MYTESTSTRING2", sQLNonTransientConnectionException
  659. .getSQLState());
  660. assertEquals(
  661. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  662. "MYTESTSTRING1", sQLNonTransientConnectionException
  663. .getMessage());
  664. assertEquals(
  665. "The error code of SQLNonTransientConnectionException should be 1",
  666. sQLNonTransientConnectionException.getErrorCode(), 1);
  667. assertEquals(
  668. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  669. cause, sQLNonTransientConnectionException.getCause());
  670. }
  671. /**
  672. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  673. * Throwable)
  674. */
  675. public void test_Constructor_LStringLStringILThrowable_1() {
  676. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  677. "MYTESTSTRING1", "MYTESTSTRING2", 1, null);
  678. assertNotNull(sQLNonTransientConnectionException);
  679. assertEquals(
  680. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  681. "MYTESTSTRING2", sQLNonTransientConnectionException
  682. .getSQLState());
  683. assertEquals(
  684. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  685. "MYTESTSTRING1", sQLNonTransientConnectionException
  686. .getMessage());
  687. assertEquals(
  688. "The error code of SQLNonTransientConnectionException should be 1",
  689. sQLNonTransientConnectionException.getErrorCode(), 1);
  690. assertNull(
  691. "The cause of SQLNonTransientConnectionException should be null",
  692. sQLNonTransientConnectionException.getCause());
  693. }
  694. /**
  695. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  696. * Throwable)
  697. */
  698. public void test_Constructor_LStringLStringILThrowable_2() {
  699. Throwable cause = new Exception("MYTHROWABLE");
  700. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  701. "MYTESTSTRING1", "MYTESTSTRING2", 0, cause);
  702. assertNotNull(sQLNonTransientConnectionException);
  703. assertEquals(
  704. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  705. "MYTESTSTRING2", sQLNonTransientConnectionException
  706. .getSQLState());
  707. assertEquals(
  708. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  709. "MYTESTSTRING1", sQLNonTransientConnectionException
  710. .getMessage());
  711. assertEquals(
  712. "The error code of SQLNonTransientConnectionException should be 0",
  713. sQLNonTransientConnectionException.getErrorCode(), 0);
  714. assertEquals(
  715. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  716. cause, sQLNonTransientConnectionException.getCause());
  717. }
  718. /**
  719. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  720. * Throwable)
  721. */
  722. public void test_Constructor_LStringLStringILThrowable_3() {
  723. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  724. "MYTESTSTRING1", "MYTESTSTRING2", 0, null);
  725. assertNotNull(sQLNonTransientConnectionException);
  726. assertEquals(
  727. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  728. "MYTESTSTRING2", sQLNonTransientConnectionException
  729. .getSQLState());
  730. assertEquals(
  731. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  732. "MYTESTSTRING1", sQLNonTransientConnectionException
  733. .getMessage());
  734. assertEquals(
  735. "The error code of SQLNonTransientConnectionException should be 0",
  736. sQLNonTransientConnectionException.getErrorCode(), 0);
  737. assertNull(
  738. "The cause of SQLNonTransientConnectionException should be null",
  739. sQLNonTransientConnectionException.getCause());
  740. }
  741. /**
  742. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  743. * Throwable)
  744. */
  745. public void test_Constructor_LStringLStringILThrowable_4() {
  746. Throwable cause = new Exception("MYTHROWABLE");
  747. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  748. "MYTESTSTRING1", "MYTESTSTRING2", -1, cause);
  749. assertNotNull(sQLNonTransientConnectionException);
  750. assertEquals(
  751. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  752. "MYTESTSTRING2", sQLNonTransientConnectionException
  753. .getSQLState());
  754. assertEquals(
  755. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  756. "MYTESTSTRING1", sQLNonTransientConnectionException
  757. .getMessage());
  758. assertEquals(
  759. "The error code of SQLNonTransientConnectionException should be -1",
  760. sQLNonTransientConnectionException.getErrorCode(), -1);
  761. assertEquals(
  762. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  763. cause, sQLNonTransientConnectionException.getCause());
  764. }
  765. /**
  766. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  767. * Throwable)
  768. */
  769. public void test_Constructor_LStringLStringILThrowable_5() {
  770. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  771. "MYTESTSTRING1", "MYTESTSTRING2", -1, null);
  772. assertNotNull(sQLNonTransientConnectionException);
  773. assertEquals(
  774. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  775. "MYTESTSTRING2", sQLNonTransientConnectionException
  776. .getSQLState());
  777. assertEquals(
  778. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  779. "MYTESTSTRING1", sQLNonTransientConnectionException
  780. .getMessage());
  781. assertEquals(
  782. "The error code of SQLNonTransientConnectionException should be -1",
  783. sQLNonTransientConnectionException.getErrorCode(), -1);
  784. assertNull(
  785. "The cause of SQLNonTransientConnectionException should be null",
  786. sQLNonTransientConnectionException.getCause());
  787. }
  788. /**
  789. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  790. * Throwable)
  791. */
  792. public void test_Constructor_LStringLStringILThrowable_6() {
  793. Throwable cause = new Exception("MYTHROWABLE");
  794. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  795. "MYTESTSTRING", null, 1, cause);
  796. assertNotNull(sQLNonTransientConnectionException);
  797. assertNull(
  798. "The SQLState of SQLNonTransientConnectionException should be null",
  799. sQLNonTransientConnectionException.getSQLState());
  800. assertEquals(
  801. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  802. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  803. assertEquals(
  804. "The error code of SQLNonTransientConnectionException should be 1",
  805. sQLNonTransientConnectionException.getErrorCode(), 1);
  806. assertEquals(
  807. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  808. cause, sQLNonTransientConnectionException.getCause());
  809. }
  810. /**
  811. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  812. * Throwable)
  813. */
  814. public void test_Constructor_LStringLStringILThrowable_7() {
  815. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  816. "MYTESTSTRING", null, 1, null);
  817. assertNotNull(sQLNonTransientConnectionException);
  818. assertNotNull(sQLNonTransientConnectionException);
  819. assertNull(
  820. "The SQLState of SQLNonTransientConnectionException should be null",
  821. sQLNonTransientConnectionException.getSQLState());
  822. assertEquals(
  823. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  824. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  825. assertEquals(
  826. "The error code of SQLNonTransientConnectionException should be 1",
  827. sQLNonTransientConnectionException.getErrorCode(), 1);
  828. assertNull(
  829. "The cause of SQLNonTransientConnectionException should be null",
  830. sQLNonTransientConnectionException.getCause());
  831. }
  832. /**
  833. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  834. * Throwable)
  835. */
  836. public void test_Constructor_LStringLStringILThrowable_8() {
  837. Throwable cause = new Exception("MYTHROWABLE");
  838. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  839. "MYTESTSTRING", null, 0, cause);
  840. assertNotNull(sQLNonTransientConnectionException);
  841. assertNull(
  842. "The SQLState of SQLNonTransientConnectionException should be null",
  843. sQLNonTransientConnectionException.getSQLState());
  844. assertEquals(
  845. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  846. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  847. assertEquals(
  848. "The error code of SQLNonTransientConnectionException should be 0",
  849. sQLNonTransientConnectionException.getErrorCode(), 0);
  850. assertEquals(
  851. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  852. cause, sQLNonTransientConnectionException.getCause());
  853. }
  854. /**
  855. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  856. * Throwable)
  857. */
  858. public void test_Constructor_LStringLStringILThrowable_9() {
  859. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  860. "MYTESTSTRING", null, 0, null);
  861. assertNotNull(sQLNonTransientConnectionException);
  862. assertNull(
  863. "The SQLState of SQLNonTransientConnectionException should be null",
  864. sQLNonTransientConnectionException.getSQLState());
  865. assertEquals(
  866. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  867. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  868. assertEquals(
  869. "The error code of SQLNonTransientConnectionException should be 0",
  870. sQLNonTransientConnectionException.getErrorCode(), 0);
  871. assertNull(
  872. "The cause of SQLNonTransientConnectionException should be null",
  873. sQLNonTransientConnectionException.getCause());
  874. }
  875. /**
  876. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  877. * Throwable)
  878. */
  879. public void test_Constructor_LStringLStringILThrowable_10() {
  880. Throwable cause = new Exception("MYTHROWABLE");
  881. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  882. "MYTESTSTRING", null, -1, cause);
  883. assertNotNull(sQLNonTransientConnectionException);
  884. assertNull(
  885. "The SQLState of SQLNonTransientConnectionException should be null",
  886. sQLNonTransientConnectionException.getSQLState());
  887. assertEquals(
  888. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  889. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  890. assertEquals(
  891. "The error code of SQLNonTransientConnectionException should be -1",
  892. sQLNonTransientConnectionException.getErrorCode(), -1);
  893. assertEquals(
  894. "The cause of SQLNonTransientConnectionException set and get should be equivalent",
  895. cause, sQLNonTransientConnectionException.getCause());
  896. }
  897. /**
  898. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  899. * Throwable)
  900. */
  901. public void test_Constructor_LStringLStringILThrowable_11() {
  902. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  903. "MYTESTSTRING", null, -1, null);
  904. assertNotNull(sQLNonTransientConnectionException);
  905. assertNull(
  906. "The SQLState of SQLNonTransientConnectionException should be null",
  907. sQLNonTransientConnectionException.getSQLState());
  908. assertEquals(
  909. "The reason of SQLNonTransientConnectionException set and get should be equivalent",
  910. "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
  911. assertEquals(
  912. "The error code of SQLNonTransientConnectionException should be -1",
  913. sQLNonTransientConnectionException.getErrorCode(), -1);
  914. assertNull(
  915. "The cause of SQLNonTransientConnectionException should be null",
  916. sQLNonTransientConnectionException.getCause());
  917. }
  918. /**
  919. * @test java.sql.SQLNonTransientConnectionException(String, String, int,
  920. * Throwable)
  921. */
  922. public void test_Constructor_LStringLStringILThrowable_12() {
  923. Throwable cause = new Exception("MYTHROWABLE");
  924. SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
  925. null, "MYTESTSTRING", 1, cause);
  926. assertNotNull(sQLNonTransientConnectionException);
  927. assertEquals(
  928. "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
  929. "MYTESTSTRING", sQLNonTransientConnectionException