Search in sources :

Example 1 with Text

use of com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder.Text in project dal by ctripcorp.

the class AbstractFreeSqlBuilderTest method testAppendWith.

@Test
public void testAppendWith() {
    AbstractFreeSqlBuilder test = create();
    test.appendWith(COMMA, new Text(template), new Text(elseTemplate));
    assertEquals("template, elseTemplate", test.build());
}
Also used : AbstractFreeSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder) Text(com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder.Text) Test(org.junit.Test)

Example 2 with Text

use of com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder.Text in project dal by ctripcorp.

the class AbstractFreeSqlBuilderTest method testAppendClauseConditionWithElse.

@Test
public void testAppendClauseConditionWithElse() {
    AbstractFreeSqlBuilder test = create();
    test.appendWhen(true, new Text(template), new Text(elseTemplate));
    assertEquals(template, test.build());
    test = create();
    test.appendWhen(false, new Text(template), new Text(elseTemplate));
    assertEquals(elseTemplate, test.build());
}
Also used : AbstractFreeSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder) Text(com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder.Text) Test(org.junit.Test)

Example 3 with Text

use of com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder.Text in project dal by ctripcorp.

the class AbstractFreeSqlBuilderTest method testAppendClauseCondition.

@Test
public void testAppendClauseCondition() {
    AbstractFreeSqlBuilder test = create();
    test.appendWhen(true, new Text(template));
    assertEquals(template, test.build());
    test = create();
    test.appendWhen(false, new Text(template));
    assertEquals(EMPTY, test.build());
}
Also used : AbstractFreeSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder) Text(com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder.Text) Test(org.junit.Test)

Example 4 with Text

use of com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder.Text in project dal by ctripcorp.

the class AbstractFreeSqlBuilderTest method testAppendClause.

@Test
public void testAppendClause() {
    AbstractFreeSqlBuilder test = create();
    test.append(new Text(template));
    assertEquals(template, test.build());
}
Also used : AbstractFreeSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder) Text(com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder.Text) Test(org.junit.Test)

Aggregations

AbstractFreeSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder)4 Text (com.ctrip.platform.dal.dao.sqlbuilder.AbstractFreeSqlBuilder.Text)4 Test (org.junit.Test)4