use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test7.
/**
* Create SQLIntegrityConstraintViolationException with message, and Throwable
*/
@Test
public void test7() {
SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException(reason, t);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test10.
/**
* Serialize a SQLIntegrityConstraintViolationException and make sure
* you can read it back properly
*/
@Test
public void test10() throws Exception {
SQLIntegrityConstraintViolationException e = new SQLIntegrityConstraintViolationException(reason, state, errorCode, t);
SQLIntegrityConstraintViolationException ex1 = createSerializedException(e);
assertTrue(reason.equals(ex1.getMessage()) && ex1.getSQLState().equals(state) && cause.equals(ex1.getCause().toString()) && ex1.getErrorCode() == errorCode);
}
use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test9.
/**
* Create SQLIntegrityConstraintViolationException with Throwable
*/
@Test
public void test9() {
SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException(t);
assertTrue(ex.getMessage().equals(cause) && ex.getSQLState() == null && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test11.
/**
* Validate that the ordering of the returned Exceptions is correct
* using for-each loop
*/
@Test
public void test11() {
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;
for (Throwable e : ex) {
assertTrue(msgs[num++].equals(e.getMessage()));
}
}
use of java.sql.SQLIntegrityConstraintViolationException in project jdk8u_jdk by JetBrains.
the class SQLIntegrityConstraintViolationExceptionTests method test2.
/**
* Create SQLIntegrityConstraintViolationException with message
*/
@Test
public void test2() {
SQLIntegrityConstraintViolationException ex = new SQLIntegrityConstraintViolationException(reason);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
Aggregations