Package com.mysema.query.sql.teradata

Source Code of com.mysema.query.sql.teradata.SetQueryBandClauseTest

package com.mysema.query.sql.teradata;

import com.mysema.query.sql.Configuration;
import com.mysema.query.sql.SQLTemplates;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

public class SetQueryBandClauseTest {

    private Configuration conf;

    private SetQueryBandClause clause;

    @Before
    public void setUp() {
        conf = new Configuration(SQLTemplates.DEFAULT);
        conf.setUseLiterals(true);
        clause = new SetQueryBandClause(null, conf);
    }

    @Test
    public void ToString() {
        clause.set("a", "b");
        assertEquals("set query_band='a=b;' for session", clause.toString());
    }

    @Test
    public void ToString2() {
        conf.setUseLiterals(false);
        clause.set("a", "b");
        clause.forTransaction();
        assertEquals("set query_band=? for transaction", clause.toString());
    }

    @Test
    public void ForTransaction() {
        clause.forTransaction();
        clause.set("a", "b");
        clause.set("b", "c");
        assertEquals("set query_band='a=b;b=c;' for transaction", clause.toString());
    }

    @Test
    public void GetSQL() {
        clause.forTransaction();
        clause.set("a", "b");
        clause.set("b", "c");
        assertEquals("set query_band='a=b;b=c;' for transaction", clause.getSQL().get(0).getSQL());
    }

}
TOP

Related Classes of com.mysema.query.sql.teradata.SetQueryBandClauseTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.