use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.
the class SQLWarningTests method test2.
/**
* Create SQLWarning with message
*/
@Test
public void test2() {
SQLWarning ex = new SQLWarning(reason);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState() == null && ex.getCause() == null && ex.getErrorCode() == 0);
}
use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.
the class SQLWarningTests method test12.
/**
* Validate that the ordering of the returned Exceptions is correct using
* traditional while loop
*/
@Test
public void test12() {
SQLWarning ex = new SQLWarning("Exception 1", t1);
SQLWarning ex1 = new SQLWarning("Exception 2");
SQLWarning ex2 = new SQLWarning("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.SQLWarning in project jdk8u_jdk by JetBrains.
the class SQLWarningTests method test.
/**
* Create SQLWarning and setting all objects to null
*/
@Test
public void test() {
SQLWarning e = new SQLWarning(null, null, errorCode, null);
assertTrue(e.getMessage() == null && e.getSQLState() == null && e.getCause() == null && e.getErrorCode() == errorCode);
}
use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.
the class SQLWarningTests method test3.
/**
* Create SQLWarning with message, and SQLState
*/
@Test
public void test3() {
SQLWarning ex = new SQLWarning(reason, state);
assertTrue(ex.getMessage().equals(reason) && ex.getSQLState().equals(state) && ex.getCause() == null && ex.getErrorCode() == 0);
}
use of java.sql.SQLWarning in project jdk8u_jdk by JetBrains.
the class SQLWarningTests method test11.
/**
* Validate that the ordering of the returned Exceptions is correct using
* for-each loop
*/
@Test
public void test11() {
SQLWarning ex = new SQLWarning("Exception 1", t1);
SQLWarning ex1 = new SQLWarning("Exception 2");
SQLWarning ex2 = new SQLWarning("Exception 3", t2);
ex.setNextException(ex1);
ex.setNextException(ex2);
int num = 0;
for (Throwable e : ex) {
assertTrue(msgs[num++].equals(e.getMessage()));
}
}
Aggregations