Search in sources :

Example 1 with DfParameterBeanMarkInvalidException

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());
    }
}
Also used : DfParameterBeanMarkInvalidException(org.dbflute.exception.DfParameterBeanMarkInvalidException) DfOutsideSqlChecker(org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker)

Example 2 with DfParameterBeanMarkInvalidException

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);
}
Also used : DfParameterBeanMarkInvalidException(org.dbflute.exception.DfParameterBeanMarkInvalidException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder)

Aggregations

DfParameterBeanMarkInvalidException (org.dbflute.exception.DfParameterBeanMarkInvalidException)2 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1 DfOutsideSqlChecker (org.dbflute.logic.outsidesqltest.DfOutsideSqlChecker)1