use of java.sql.SQLTimeoutException in project jdk8u_jdk by JetBrains.
the class SQLTimeoutExceptionTests method test13.
/**
* Create SQLTimeoutException and validate it is an instance of
* SQLNonTransientException
*/
@Test
public void test13() {
Exception ex = new SQLTimeoutException();
assertTrue(ex instanceof SQLTransientException);
}
use of java.sql.SQLTimeoutException in project jdk8u_jdk by JetBrains.
the class SQLTimeoutExceptionTests method test9.
/**
* Create SQLTimeoutException with Throwable
*/
@Test
public void test9() {
SQLTimeoutException ex = new SQLTimeoutException(t);
assertTrue(ex.getMessage().equals(cause) && ex.getSQLState() == null && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
use of java.sql.SQLTimeoutException in project jdk8u_jdk by JetBrains.
the class SQLTimeoutExceptionTests method test6.
/**
* Create SQLTimeoutException with message, SQLState, and Throwable
*/
@Test
public void test6() {
SQLTimeoutException ex = new SQLTimeoutException(reason, state, t);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && cause.equals(ex.getCause().toString()) && ex.getErrorCode() == 0);
}
use of java.sql.SQLTimeoutException in project jdk8u_jdk by JetBrains.
the class SQLTimeoutExceptionTests method test10.
/**
* Serialize a SQLTimeoutException and make sure you can read it back properly
*/
@Test
public void test10() throws Exception {
SQLTimeoutException e = new SQLTimeoutException(reason, state, errorCode, t);
SQLTimeoutException ex1 = createSerializedException(e);
assertTrue(reason.equals(ex1.getMessage()) && ex1.getSQLState().equals(state) && cause.equals(ex1.getCause().toString()) && ex1.getErrorCode() == errorCode);
}
use of java.sql.SQLTimeoutException in project jdk8u_jdk by JetBrains.
the class SQLTimeoutExceptionTests method test11.
/**
* Validate that the ordering of the returned Exceptions is correct
* using for-each loop
*/
@Test
public void test11() {
SQLTimeoutException ex = new SQLTimeoutException("Exception 1", t1);
SQLTimeoutException ex1 = new SQLTimeoutException("Exception 2");
SQLTimeoutException ex2 = new SQLTimeoutException("Exception 3", t2);
ex.setNextException(ex1);
ex.setNextException(ex2);
int num = 0;
for (Throwable e : ex) {
assertTrue(msgs[num++].equals(e.getMessage()));
}
}
Aggregations