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

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