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

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