use of com.google.api.ads.admanager.axis.v202111.Row in project googleads-java-lib by googleads.
the class PqlTest method testCombineResultSet.
@Test
public void testCombineResultSet() {
Row row1 = new Row();
row1.getValues().addAll(Lists.newArrayList(textValue1, booleanValue1, numberValue1));
Row row2 = new Row();
row2.getValues().addAll(Lists.newArrayList(textValue2, booleanValue2, numberValue2));
Row row3 = new Row();
row3.getValues().addAll(Lists.newArrayList(textValue3, booleanValue3, numberValue3));
ResultSet resultSet1 = new ResultSet();
resultSet1.getColumnTypes().addAll(Lists.newArrayList(column1, column2, column3));
resultSet1.getRows().addAll(Lists.newArrayList(row1, row2));
ResultSet resultSet2 = new ResultSet();
resultSet2.getColumnTypes().addAll(Lists.newArrayList(column1, column2, column3));
resultSet2.getRows().addAll(Lists.newArrayList(row3));
ResultSet combinedResultSet = Pql.combineResultSets(resultSet1, resultSet2);
assertEquals(3, combinedResultSet.getRows().size());
assertEquals(Lists.newArrayList(column1, column2, column3), combinedResultSet.getColumnTypes());
assertEquals(Lists.newArrayList(textValue1, booleanValue1, numberValue1), combinedResultSet.getRows().get(0).getValues());
assertEquals(Lists.newArrayList(textValue2, booleanValue2, numberValue2), combinedResultSet.getRows().get(1).getValues());
assertEquals(Lists.newArrayList(textValue3, booleanValue3, numberValue3), combinedResultSet.getRows().get(2).getValues());
}
use of com.google.api.ads.admanager.axis.v202111.Row in project googleads-java-lib by googleads.
the class PqlTest method testGetRowStringValues.
@Test
public void testGetRowStringValues() {
Row row = new Row();
row.getValues().addAll(Lists.newArrayList(textValue1, booleanValue1, numberValue2, numberSetValue));
assertEquals(Lists.newArrayList("value1", "false", "1.02", "1,-1"), Pql.getRowStringValues(row));
}
use of com.google.api.ads.admanager.axis.v202111.Row in project googleads-java-lib by googleads.
the class PqlTest method testCombineResultSet.
@Test
public void testCombineResultSet() {
Row row1 = new Row();
row1.getValues().addAll(Lists.newArrayList(textValue1, booleanValue1, numberValue1));
Row row2 = new Row();
row2.getValues().addAll(Lists.newArrayList(textValue2, booleanValue2, numberValue2));
Row row3 = new Row();
row3.getValues().addAll(Lists.newArrayList(textValue3, booleanValue3, numberValue3));
ResultSet resultSet1 = new ResultSet();
resultSet1.getColumnTypes().addAll(Lists.newArrayList(column1, column2, column3));
resultSet1.getRows().addAll(Lists.newArrayList(row1, row2));
ResultSet resultSet2 = new ResultSet();
resultSet2.getColumnTypes().addAll(Lists.newArrayList(column1, column2, column3));
resultSet2.getRows().addAll(Lists.newArrayList(row3));
ResultSet combinedResultSet = Pql.combineResultSets(resultSet1, resultSet2);
assertEquals(3, combinedResultSet.getRows().size());
assertEquals(Lists.newArrayList(column1, column2, column3), combinedResultSet.getColumnTypes());
assertEquals(Lists.newArrayList(textValue1, booleanValue1, numberValue1), combinedResultSet.getRows().get(0).getValues());
assertEquals(Lists.newArrayList(textValue2, booleanValue2, numberValue2), combinedResultSet.getRows().get(1).getValues());
assertEquals(Lists.newArrayList(textValue3, booleanValue3, numberValue3), combinedResultSet.getRows().get(2).getValues());
}
use of com.google.api.ads.admanager.axis.v202111.Row in project googleads-java-lib by googleads.
the class PqlTest method testCombineResultSet_badColumns.
@Test
public void testCombineResultSet_badColumns() {
Row row1 = new Row();
row1.getValues().addAll(Lists.newArrayList(textValue1, booleanValue1, numberValue1));
Row row2 = new Row();
row2.getValues().addAll(Lists.newArrayList(textValue2, booleanValue2, numberValue2));
Row row3 = new Row();
row3.getValues().addAll(Lists.newArrayList(textValue3, booleanValue3));
ResultSet resultSet1 = new ResultSet();
resultSet1.getColumnTypes().addAll(Lists.newArrayList(column1, column2, column3));
resultSet1.getRows().addAll(Lists.newArrayList(row1, row2));
ResultSet resultSet2 = new ResultSet();
resultSet2.getColumnTypes().addAll(Lists.newArrayList(column1, column2));
resultSet2.getRows().addAll(Lists.newArrayList(row3));
thrown.expect(IllegalArgumentException.class);
Pql.combineResultSets(resultSet1, resultSet2);
}
use of com.google.api.ads.admanager.axis.v202111.Row in project googleads-java-lib by googleads.
the class PqlTest method testCombineResultSet_badColumns.
@Test
public void testCombineResultSet_badColumns() {
Row row1 = new Row();
row1.getValues().addAll(Lists.newArrayList(textValue1, booleanValue1, numberValue1));
Row row2 = new Row();
row2.getValues().addAll(Lists.newArrayList(textValue2, booleanValue2, numberValue2));
Row row3 = new Row();
row3.getValues().addAll(Lists.newArrayList(textValue3, booleanValue3));
ResultSet resultSet1 = new ResultSet();
resultSet1.getColumnTypes().addAll(Lists.newArrayList(column1, column2, column3));
resultSet1.getRows().addAll(Lists.newArrayList(row1, row2));
ResultSet resultSet2 = new ResultSet();
resultSet2.getColumnTypes().addAll(Lists.newArrayList(column1, column2));
resultSet2.getRows().addAll(Lists.newArrayList(row3));
thrown.expect(IllegalArgumentException.class);
Pql.combineResultSets(resultSet1, resultSet2);
}
Aggregations