@@ -121,6 +121,17 @@ public class BigQueryImplTest {
121121 .setSchema (TABLE_SCHEMA )
122122 .setTimePartitioning (TIME_PARTITIONING )
123123 .build ();
124+ private static final RangePartitioning .Range RANGE =
125+ RangePartitioning .Range .newBuilder ().setStart (1L ).setInterval (2L ).setEnd (10L ).build ();
126+ private static final RangePartitioning RANGE_PARTITIONING =
127+ RangePartitioning .newBuilder ().setField ("IntegerField" ).setRange (RANGE ).build ();
128+ private static final StandardTableDefinition TABLE_DEFINITION_WITH_RANGE_PARTITIONING =
129+ StandardTableDefinition .newBuilder ()
130+ .setSchema (TABLE_SCHEMA )
131+ .setRangePartitioning (RANGE_PARTITIONING )
132+ .build ();
133+ private static final TableInfo TABLE_INFO_RANGE_PARTITIONING =
134+ TableInfo .of (TABLE_ID , TABLE_DEFINITION_WITH_RANGE_PARTITIONING );
124135 private static final TableInfo TABLE_INFO = TableInfo .of (TABLE_ID , TABLE_DEFINITION );
125136 private static final TableInfo OTHER_TABLE_INFO = TableInfo .of (OTHER_TABLE_ID , TABLE_DEFINITION );
126137 private static final TableInfo TABLE_INFO_WITH_PROJECT =
@@ -901,6 +912,22 @@ public void testListTablesReturnedParameters() {
901912 assertArrayEquals (tableList .toArray (), Iterables .toArray (page .getValues (), Table .class ));
902913 }
903914
915+ @ Test
916+ public void testListTablesWithRangePartitioning () {
917+ bigquery = options .getService ();
918+ ImmutableList <Table > tableList =
919+ ImmutableList .of (
920+ new Table (bigquery , new TableInfo .BuilderImpl (TABLE_INFO_RANGE_PARTITIONING )));
921+ Tuple <String , Iterable <com .google .api .services .bigquery .model .Table >> result =
922+ Tuple .of (CURSOR , Iterables .transform (tableList , TableInfo .TO_PB_FUNCTION ));
923+ EasyMock .expect (bigqueryRpcMock .listTables (PROJECT , DATASET , TABLE_LIST_OPTIONS ))
924+ .andReturn (result );
925+ EasyMock .replay (bigqueryRpcMock );
926+ Page <Table > page = bigquery .listTables (DATASET , TABLE_LIST_PAGE_SIZE , TABLE_LIST_PAGE_TOKEN );
927+ assertEquals (CURSOR , page .getNextPageToken ());
928+ assertArrayEquals (tableList .toArray (), Iterables .toArray (page .getValues (), Table .class ));
929+ }
930+
904931 @ Test
905932 public void testListTablesFromDatasetId () {
906933 bigquery = options .getService ();
0 commit comments