Search in sources :

Example 11 with SQLIntegrityConstraintViolationException

use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.

the class SQLIntegrityConstraintViolationExceptionTests method test.

/**
     * Create SQLIntegrityConstraintViolationException and setting all objects to null
     */
@Test
public void test() {
    SQLIntegrityConstraintViolationException e = new SQLIntegrityConstraintViolationException(null, null, errorCode, null);
    assertTrue(e.getMessage() == null && e.getSQLState() == null && e.getCause() == null && e.getErrorCode() == errorCode);
}
Also used : SQLIntegrityConstraintViolationException(java.sql.SQLIntegrityConstraintViolationException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 12 with SQLIntegrityConstraintViolationException

use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.

the class SQLIntegrityConstraintViolationExceptionTests method test6.

/**
     * Create SQLIntegrityConstraintViolationException with message, SQLState, and Throwable
     */
@Test
public void test6() {
    SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException(reason, state, t);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
Also used : SQLIntegrityConstraintViolationException(java.sql.SQLIntegrityConstraintViolationException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 13 with SQLIntegrityConstraintViolationException

use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.

the class SQLIntegrityConstraintViolationExceptionTests method test4.

/**
     * Create SQLIntegrityConstraintViolationException with message, SQLState, and error code
     */
@Test
public void test4() {
    SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException(reason, state, errorCode);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == errorCode);
}
Also used : SQLIntegrityConstraintViolationException(java.sql.SQLIntegrityConstraintViolationException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 14 with SQLIntegrityConstraintViolationException

use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.

the class SQLIntegrityConstraintViolationExceptionTests method test1.

/**
     * Create SQLIntegrityConstraintViolationException with no-arg constructor
     */
@Test
public void test1() {
    SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException();
    assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Also used : SQLIntegrityConstraintViolationException(java.sql.SQLIntegrityConstraintViolationException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

SQLIntegrityConstraintViolationException (java.sql.SQLIntegrityConstraintViolationException)14 Test (org.testng.annotations.Test)14 BaseTest (util.BaseTest)14 SQLException (java.sql.SQLException)2 SQLNonTransientException (java.sql.SQLNonTransientException)1