use of com.google.api.ads.admanager.axis.v202105.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testLimit.
@Test
public void testLimit() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.limit(500).toStatement();
assertEquals("LIMIT 500", statement.getQuery());
}
use of com.google.api.ads.admanager.axis.v202105.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testBindVariables_number.
@Test
public void testBindVariables_number() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.where("number = :number").withBindVariableValue("number", 1).toStatement();
String_ValueMapEntry entry = statement.getValues(0);
assertEquals("number", entry.getKey());
assertEquals(NumberValue.class, entry.getValue().getClass());
assertEquals("1", ((NumberValue) entry.getValue()).getValue());
}
use of com.google.api.ads.admanager.axis.v202105.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testIncreaseOffset.
@Test
public void testIncreaseOffset() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement initialOffset = statementBuilder.limit(100).offset(100).toStatement();
assertEquals("LIMIT 100 OFFSET 100", initialOffset.getQuery());
Statement increasedOffset = statementBuilder.increaseOffsetBy(100).toStatement();
assertEquals("LIMIT 100 OFFSET 200", increasedOffset.getQuery());
}
use of com.google.api.ads.admanager.axis.v202105.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testWhere_stripsWhere.
@Test
public void testWhere_stripsWhere() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.where("WHERE id = 12345").toStatement();
assertEquals("WHERE id = 12345", statement.getQuery());
}
use of com.google.api.ads.admanager.axis.v202105.Statement in project googleads-java-lib by googleads.
the class StatementBuilderTest method testBindVariables_bool.
@Test
public void testBindVariables_bool() {
StatementBuilder statementBuilder = new StatementBuilder();
Statement statement = statementBuilder.where("bool = :bool").withBindVariableValue("bool", true).toStatement();
String_ValueMapEntry entry = statement.getValues(0);
assertEquals("bool", entry.getKey());
assertEquals(BooleanValue.class, entry.getValue().getClass());
assertEquals(true, ((BooleanValue) entry.getValue()).getValue());
}
Aggregations