String error = (success || compiler.m_errors.size() == 0
? ""
: compiler.m_errors.get(compiler.m_errors.size()-1).message);
if (errorRegex == null) {
assertTrue(String.format("Expected success\nDDL: %s\n%s", ddl, error), success);
Catalog cat = compiler.getCatalog();
return cat.getClusters().get("cluster").getDatabases().get("database");
}
else {
assertFalse(String.format("Expected error (\"%s\")\nDDL: %s", errorRegex, ddl), success);
assertFalse("Expected at least one error message.", error.isEmpty());
Matcher m = Pattern.compile(errorRegex).matcher(error);