Search in sources :

Example 6 with SQLRecoverableException

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

the class SQLRecoverableExceptionTests method test11.

/**
     * Validate that the ordering of the returned Exceptions is correct
     * using for-each loop
     */
@Test
public void test11() {
    SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
    SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
    SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
Also used : SQLRecoverableException(java.sql.SQLRecoverableException) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 7 with SQLRecoverableException

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

the class SQLRecoverableExceptionTests method test4.

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

Example 8 with SQLRecoverableException

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

the class SQLRecoverableExceptionTests method test7.

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

Example 9 with SQLRecoverableException

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

the class SQLRecoverableExceptionTests method test8.

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

Example 10 with SQLRecoverableException

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

the class SQLRecoverableExceptionTests method test1.

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

Aggregations

SQLRecoverableException (java.sql.SQLRecoverableException)14 Test (org.testng.annotations.Test)13 BaseTest (util.BaseTest)13 SQLException (java.sql.SQLException)2 IOException (java.io.IOException)1 SQLDataException (java.sql.SQLDataException)1 SQLFeatureNotSupportedException (java.sql.SQLFeatureNotSupportedException)1 SQLNonTransientConnectionException (java.sql.SQLNonTransientConnectionException)1 ParseException (java.text.ParseException)1 DateTime (org.joda.time.DateTime)1 SQLCommand (org.xbib.elasticsearch.common.util.SQLCommand)1