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