use of java.sql.SQLRecoverableException in project jdk8u_jdk by JetBrains.
the class SQLRecoverableExceptionTests method test12.
/**
* Validate that the ordering of the returned Exceptions is correct
* using traditional while loop
*/
@Test
public void test12() {
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;
SQLException sqe = ex;
while (sqe != null) {
assertTrue(msgs[num++].equals(sqe.getMessage()));
Throwable c = sqe.getCause();
while (c != null) {
assertTrue(msgs[num++].equals(c.getMessage()));
c = c.getCause();
}
sqe = sqe.getNextException();
}
}
use of java.sql.SQLRecoverableException in project jdk8u_jdk by JetBrains.
the class SQLRecoverableExceptionTests method test.
/**
* Create SQLRecoverableException and setting all objects to null
*/
@Test
public void test() {
SQLRecoverableException e = new SQLRecoverableException(null, null, errorCode, null);
assertTrue(e.getMessage() == null && e.getSQLState() == null && e.getCause() == null && e.getErrorCode() == errorCode);
}
use of java.sql.SQLRecoverableException in project jdk8u_jdk by JetBrains.
the class SQLRecoverableExceptionTests method test2.
/**
* Create SQLRecoverableException with message
*/
@Test
public void test2() {
SQLRecoverableException ex = new SQLRecoverableException(reason);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
use of java.sql.SQLRecoverableException in project jdk8u_jdk by JetBrains.
the class SQLRecoverableExceptionTests method test3.
/**
* Create SQLRecoverableException with message, and SQLState
*/
@Test
public void test3() {
SQLRecoverableException ex = new SQLRecoverableException(reason, state);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == 0);
}
Aggregations