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

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