20 import java.sql.SQLException;
22 import com.mysql.clusterj.ClusterJUserException;
24 import testsuite.clusterj.AbstractClusterJTest;
29 getConnection(
"target/test-classes/bad-connection-no-statement-interceptor.properties");
30 connection.prepareStatement(
"SELECT 1 FROM DUAL");
31 fail(
"Missing statement interceptor should fail with ClusterJUserException.");
32 }
catch (SQLException e) {
34 }
catch (RuntimeException runtimeException) {
35 Throwable sqlException = runtimeException.getCause();
36 if (sqlException instanceof SQLException) {
37 Throwable clusterJException = sqlException.getCause();
39 if (clusterJException.getMessage().contains(
"statementInterceptors")) {
42 if (
getDebug()) sqlException.printStackTrace();
43 fail(
"Exception should contain the string 'connectionLifecycleInterceptors'");
46 if (
getDebug()) sqlException.printStackTrace();
47 fail(
"Exception should be a ClusterJUserException wrapped in a SQLException.");
50 if (
getDebug()) sqlException.printStackTrace();
51 fail(
"Exception should be a ClusterJUserException wrapped in a SQLException.");