Search in sources :

Example 1 with SQLTransactionRollbackException

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

the class SQLTransactionRollbackExceptionTests method test10.

/**
     * Serialize a SQLTransactionRollbackException and make sure you can read it back properly
     */
@Test
public void test10() throws Exception {
    SQLTransactionRollbackException e = new SQLTransactionRollbackException(reason, state, errorCode, t);
    SQLTransactionRollbackException ex1 = createSerializedException(e);
    assertTrue(reason.equals(ex1.getMessage()) && ex1.getSQLState().equals(state) && cause.equals(ex1.getCause().toString()) && ex1.getErrorCode() == errorCode);
}
Also used : SQLTransactionRollbackException(java.sql.SQLTransactionRollbackException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 2 with SQLTransactionRollbackException

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

the class SQLTransactionRollbackExceptionTests method test5.

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

Example 3 with SQLTransactionRollbackException

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

the class SQLTransactionRollbackExceptionTests method test2.

/**
     * Create SQLTransactionRollbackException with message
     */
@Test
public void test2() {
    SQLTransactionRollbackException ex = new SQLTransactionRollbackException(reason);
    assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Also used : SQLTransactionRollbackException(java.sql.SQLTransactionRollbackException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 4 with SQLTransactionRollbackException

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

the class SQLTransactionRollbackExceptionTests method test.

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

Example 5 with SQLTransactionRollbackException

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

the class SQLTransactionRollbackExceptionTests method test6.

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

Aggregations

SQLTransactionRollbackException (java.sql.SQLTransactionRollbackException)17 Test (org.testng.annotations.Test)14 BaseTest (util.BaseTest)14 SQLException (java.sql.SQLException)4 PreparedStatement (java.sql.PreparedStatement)3 Connection (java.sql.Connection)2 Statement (java.sql.Statement)2 SQLTransientException (java.sql.SQLTransientException)1