*
* @throws Exception
*/
@Test
public void testExceptionOrNot() throws Exception {
PoolProperties props = null;
String[] exceptionInducingConfigs = {
"EmptyParmsInterceptor()",
"WhitespaceParmsInterceptor( )"
};
for (String badConfig : exceptionInducingConfigs) {
props = new PoolProperties();
props.setJdbcInterceptors(badConfig);
try {
props.getJdbcInterceptorsAsArray();
fail("Expected exception.");
} catch (Exception e) {
// Expected
}
}
String[] noExceptionButInvalidConfigs = {
"MalformedParmsInterceptor(= )",
"MalformedParmsInterceptor( =)",
"MalformedParmsInterceptor(",
"MalformedParmsInterceptor( ",
"MalformedParmsInterceptor)",
"MalformedParmsInterceptor) ",
"MalformedParmsInterceptor )"
};
for (String badConfig : noExceptionButInvalidConfigs) {
props = new PoolProperties();
props.setJdbcInterceptors(badConfig);
try {
props.getJdbcInterceptorsAsArray();
} catch (Exception e) {
fail("Unexpected exception.");
}
}
}