use of java.sql.BatchUpdateException in project jdk8u_jdk by JetBrains.
the class BatchUpdateExceptionTests method test12.
/**
* Serialize a BatchUpdateException and make sure you can read it back
* properly
*/
@Test
public void test12() throws Exception {
BatchUpdateException be = new BatchUpdateException(reason, state, errorCode, uc, t);
BatchUpdateException bue = createSerializedException(be);
assertTrue(reason.equals(bue.getMessage()) && bue.getSQLState().equals(state) && cause.equals(bue.getCause().toString()) && bue.getErrorCode() == errorCode && Arrays.equals(bue.getLargeUpdateCounts(), luc) && Arrays.equals(bue.getUpdateCounts(), uc));
}
use of java.sql.BatchUpdateException in project jdk8u_jdk by JetBrains.
the class BatchUpdateExceptionTests method test5.
/**
* Create BatchUpdateException with Throwable and update counts
*/
@Test
public void test5() {
BatchUpdateException ex = new BatchUpdateException(uc, t);
assertTrue(ex.getMessage().equals(cause) && ex.getSQLState() == null && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0 && Arrays.equals(ex.getUpdateCounts(), uc) && Arrays.equals(ex.getLargeUpdateCounts(), luc));
}
use of java.sql.BatchUpdateException in project jdk8u_jdk by JetBrains.
the class BatchUpdateExceptionTests method test9.
/**
* Create BatchUpdateException with message, SQLState, errorCode code
* Throwable, and long [] update counts
*/
@Test
public void test9() {
BatchUpdateException ex = new BatchUpdateException(reason, state, errorCode, luc, t);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == errorCode && Arrays.equals(ex.getUpdateCounts(), uc) && Arrays.equals(ex.getLargeUpdateCounts(), luc));
}
use of java.sql.BatchUpdateException in project jdk8u_jdk by JetBrains.
the class BatchUpdateExceptionTests method test.
/**
* Create BatchUpdateException and setting all objects to null
*/
@Test
public void test() {
BatchUpdateException be = new BatchUpdateException(null, null, errorCode, (int[]) null, null);
assertTrue(be.getMessage() == null && be.getSQLState() == null && be.getUpdateCounts() == null && be.getCause() == null && be.getLargeUpdateCounts() == null && be.getErrorCode() == errorCode);
}
use of java.sql.BatchUpdateException in project jdk8u_jdk by JetBrains.
the class BatchUpdateExceptionTests method test15.
/**
* Validate that the ordering of the returned Exceptions is correct
* using for-each loop
*/
@Test
public void test15() {
BatchUpdateException ex = new BatchUpdateException("Exception 1", uc, t1);
BatchUpdateException ex1 = new BatchUpdateException("Exception 2", uc);
BatchUpdateException ex2 = new BatchUpdateException("Exception 3", uc, t2);
ex.setNextException(ex1);
ex.setNextException(ex2);
int num = 0;
for (Throwable e : ex) {
assertTrue(msgs[num++].equals(e.getMessage()));
}
}
Aggregations