use of org.dbflute.exception.DfParameterBeanMarkInvalidException in project dbflute-core by dbflute.
the class OutsideSqlCheckerTest method test_check_parameterBean.
public void test_check_parameterBean() {
// ## Arrange ##
DfOutsideSqlChecker ker = new DfOutsideSqlChecker();
String fn = "test.sql";
// ## Act ##
try {
ker.check(fn, "-- #df:entity#\n-- !df;pmb!\nfoo /*IF pmb.memberId != null*/bar/*END*/");
// ## Assert ##
fail();
} catch (DfParameterBeanMarkInvalidException e) {
// OK
log(e.getMessage());
}
// ## Act ##
try {
ker.check(fn, "-- #df:entity#\n-- !df:entity!\nfoo /*IF pmb.memberId != null*/bar/*END*/");
// ## Assert ##
fail();
} catch (DfParameterBeanMarkInvalidException e) {
// OK
log(e.getMessage());
}
// ## Act ##
try {
ker.check(fn, "-- #df:entity#\n-- !df:pnb!\nfoo /*IF pmb.memberId != null*/bar/*END*/");
// ## Assert ##
fail();
} catch (DfParameterBeanMarkInvalidException e) {
// OK
log(e.getMessage());
}
}
use of org.dbflute.exception.DfParameterBeanMarkInvalidException in project dbflute-core by dbflute.
the class DfOutsideSqlChecker method throwParameterBeanMarkInvalidException.
protected void throwParameterBeanMarkInvalidException(String line, String fileName, String sql) {
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The ParameterBean mark was invalid.");
br.addItem("Advice");
br.addElement("Please confirm your ParameterBean mark.");
br.addElement("For example:");
br.addElement(" (x): -- !df;pmb! *NOT semicolun");
br.addElement(" (x): -- !df:entity! *NOT customize entity");
br.addElement(" (x): -- !df:pnb! *NOT pnb ('pmb' is right)");
br.addElement(" (o): -- !df:pmb!");
br.addItem("ParameterBean Mark");
br.addElement(line);
br.addItem("SQL File");
br.addElement(fileName);
br.addItem("Your SQL");
br.addElement(sql);
final String msg = br.buildExceptionMessage();
throw new DfParameterBeanMarkInvalidException(msg);
}
Aggregations