use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test12.
/**
* Validate that the ordering of the returned Exceptions is correct
* using traditional while loop
*/
@Test
public void test12() {
SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException("Exception 1", t1);
SQLIntegrityConstraintViolationException ex1 = new SQLIntegrityConstraintViolationException("Exception 2");
SQLIntegrityConstraintViolationException ex2 = new SQLIntegrityConstraintViolationException("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.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test13.
/**
* Create SQLIntegrityConstraintViolationException and validate it is an instance of
* SQLNonTransientException
*/
@Test
public void test13() {
Exception ex = new SQLIntegrityConstraintViolationException();
assertTrue(ex instanceof SQLNonTransientException);
}
use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test8.
/**
* Create SQLIntegrityConstraintViolationException with null Throwable
*/
@Test
public void test8() {
SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException((Throwable) null);
assertTrue(ex.getMessage() == null && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test3.
/**
* Create SQLIntegrityConstraintViolationException with message, and SQLState
*/
@Test
public void test3() {
SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException(reason, state);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == 0);
}
use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test5.
/**
* Create SQLIntegrityConstraintViolationException with message, SQLState, errorCode, and Throwable
*/
@Test
public void test5() {
SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException(reason, state, errorCode, t);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == errorCode);
}
Aggregations