Search in sources :

Example 1 with IfCommentNotFoundPropertyException

use of org.dbflute.twowaysql.exception.IfCommentNotFoundPropertyException in project dbflute-core by dbflute.

the class BeginNodeTest method test_parse_BEGIN_IF_notFoundProperty_with_likeSearch.

public void test_parse_BEGIN_IF_notFoundProperty_with_likeSearch() {
    // ## Arrange ##
    String sql = "/*BEGIN*/where";
    sql = sql + " /*IF pmb.wrongMemberId != null*/member.MEMBER_ID = /*pmb.memberId*/3/*END*/";
    sql = sql + " /*IF pmb.memberName != null*/and member.MEMBER_NAME like /*pmb.memberName*/'foo%'/*END*/";
    sql = sql + "/*END*/";
    SqlAnalyzer analyzer = new SqlAnalyzer(sql, false);
    // ## Act ##
    try {
        MockLikeSearchMemberPmb pmb = new MockLikeSearchMemberPmb();
        Node rootNode = analyzer.analyze();
        CommandContext ctx = createCtx(pmb);
        rootNode.accept(ctx);
        // ## Assert ##
        fail();
    } catch (IfCommentNotFoundPropertyException e) {
        // OK
        log(e.getMessage());
    }
}
Also used : IfCommentNotFoundPropertyException(org.dbflute.twowaysql.exception.IfCommentNotFoundPropertyException) CommandContext(org.dbflute.twowaysql.context.CommandContext) SqlAnalyzer(org.dbflute.twowaysql.SqlAnalyzer)

Example 2 with IfCommentNotFoundPropertyException

use of org.dbflute.twowaysql.exception.IfCommentNotFoundPropertyException in project dbflute-core by dbflute.

the class BeginNodeTest method test_parse_BEGIN_IF_notFoundProperty_basic.

// ===================================================================================
// NotFound Property
// =================
public void test_parse_BEGIN_IF_notFoundProperty_basic() {
    // ## Arrange ##
    String sql = "/*BEGIN*/where";
    sql = sql + " /*IF pmb.wrongMemberId != null*/member.MEMBER_ID = 3/*END*/";
    sql = sql + " /*IF pmb.memberName != null*/and member.MEMBER_NAME = 'foo'/*END*/";
    sql = sql + "/*END*/";
    SqlAnalyzer analyzer = new SqlAnalyzer(sql, false);
    // ## Act ##
    try {
        MockMemberPmb pmb = new MockMemberPmb();
        pmb.setMemberName("foo");
        Node rootNode = analyzer.analyze();
        CommandContext ctx = createCtx(pmb);
        rootNode.accept(ctx);
        // ## Assert ##
        fail();
    } catch (IfCommentNotFoundPropertyException e) {
        // OK
        log(e.getMessage());
    }
}
Also used : IfCommentNotFoundPropertyException(org.dbflute.twowaysql.exception.IfCommentNotFoundPropertyException) CommandContext(org.dbflute.twowaysql.context.CommandContext) SqlAnalyzer(org.dbflute.twowaysql.SqlAnalyzer)

Example 3 with IfCommentNotFoundPropertyException

use of org.dbflute.twowaysql.exception.IfCommentNotFoundPropertyException in project dbflute-core by dbflute.

the class BeginNodeTest method test_parse_BEGIN_IF_notFoundProperty_with_parameterMap.

public void test_parse_BEGIN_IF_notFoundProperty_with_parameterMap() {
    // ## Arrange ##
    String sql = "/*BEGIN*/where";
    sql = sql + " /*IF pmb.wrongMemberId != null*/member.MEMBER_ID = /*pmb.memberId*/3/*END*/";
    sql = sql + " /*IF pmb.memberName != null*/and member.MEMBER_NAME like /*pmb.memberName*/'foo%'/*END*/";
    sql = sql + "/*END*/";
    SqlAnalyzer analyzer = new SqlAnalyzer(sql, false);
    // ## Act ##
    try {
        MockPagingMemberPmb pmb = new MockPagingMemberPmb();
        Node rootNode = analyzer.analyze();
        CommandContext ctx = createCtx(pmb);
        rootNode.accept(ctx);
        // ## Assert ##
        fail();
    } catch (IfCommentNotFoundPropertyException e) {
        // OK
        log(e.getMessage());
    }
}
Also used : IfCommentNotFoundPropertyException(org.dbflute.twowaysql.exception.IfCommentNotFoundPropertyException) CommandContext(org.dbflute.twowaysql.context.CommandContext) SqlAnalyzer(org.dbflute.twowaysql.SqlAnalyzer)

Aggregations

SqlAnalyzer (org.dbflute.twowaysql.SqlAnalyzer)3 CommandContext (org.dbflute.twowaysql.context.CommandContext)3 IfCommentNotFoundPropertyException (org.dbflute.twowaysql.exception.IfCommentNotFoundPropertyException)3