use of java.sql.SQLTransactionRollbackException in project jdk8u_jdk by JetBrains.
the class SQLTransactionRollbackExceptionTests method test12.
/**
* Validate that the ordering of the returned Exceptions is correct
* using traditional while loop
*/
@Test
public void test12() {
SQLTransactionRollbackException ex = new SQLTransactionRollbackException("Exception 1", t1);
SQLTransactionRollbackException ex1 = new SQLTransactionRollbackException("Exception 2");
SQLTransactionRollbackException ex2 = new SQLTransactionRollbackException("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.SQLTransactionRollbackException in project jdk8u_jdk by JetBrains.
the class SQLTransactionRollbackExceptionTests method test11.
/**
* Validate that the ordering of the returned Exceptions is correct
* using for-each loop
*/
@Test
public void test11() {
SQLTransactionRollbackException ex = new SQLTransactionRollbackException("Exception 1", t1);
SQLTransactionRollbackException ex1 = new SQLTransactionRollbackException("Exception 2");
SQLTransactionRollbackException ex2 = new SQLTransactionRollbackException("Exception 3", t2);
ex.setNextException(ex1);
ex.setNextException(ex2);
int num = 0;
for (Throwable e : ex) {
assertTrue(msgs[num++].equals(e.getMessage()));
}
}
use of java.sql.SQLTransactionRollbackException in project jdk8u_jdk by JetBrains.
the class SQLTransactionRollbackExceptionTests method test4.
/**
* Create SQLTransactionRollbackException with message, SQLState, and error code
*/
@Test
public void test4() {
SQLTransactionRollbackException ex = new SQLTransactionRollbackException(reason, state, errorCode);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == errorCode);
}
use of java.sql.SQLTransactionRollbackException in project jdk8u_jdk by JetBrains.
the class SQLTransactionRollbackExceptionTests method test13.
/**
* Create SQLTransactionRollbackException and validate it is an instance of
* SQLNonTransientException
*/
@Test
public void test13() {
Exception ex = new SQLTransactionRollbackException();
assertTrue(ex instanceof SQLTransientException);
}
use of java.sql.SQLTransactionRollbackException in project jdk8u_jdk by JetBrains.
the class SQLTransactionRollbackExceptionTests method test8.
/**
* Create SQLTransactionRollbackException with null Throwable
*/
@Test
public void test8() {
SQLTransactionRollbackException ex = new SQLTransactionRollbackException((Throwable) null);
assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Aggregations