@@ -133,6 +133,17 @@ private static Table tableWithBasicSchema() {
133133 new TableFieldSchema ().setName ("anniversary_time" ).setType ("TIME" ))));
134134 }
135135
136+ private static Table noTableQuerySchema () {
137+ return new Table ()
138+ .setSchema (
139+ new TableSchema ()
140+ .setFields (
141+ Arrays .asList (
142+ new TableFieldSchema ().setName ("name" ).setType ("STRING" ),
143+ new TableFieldSchema ().setName ("count" ).setType ("INTEGER" ),
144+ new TableFieldSchema ().setName ("photo" ).setType ("BYTES" ))));
145+ }
146+
136147 private static Table tableWithLocation () {
137148 return new Table ()
138149 .setLocation ("EU" );
@@ -206,6 +217,7 @@ public void testReadFromQuery() throws IOException, InterruptedException {
206217 assertEquals ("2000-01-01" , row .get ("anniversary_date" ));
207218 assertEquals ("2000-01-01 00:00:00.000005" , row .get ("anniversary_datetime" ));
208219 assertEquals ("00:00:00.000005" , row .get ("anniversary_time" ));
220+
209221 assertFalse (iterator .advance ());
210222 }
211223
@@ -257,14 +269,13 @@ public void testReadFromQueryNoTables() throws IOException, InterruptedException
257269 when (mockJobsGet .execute ()).thenReturn (getJob );
258270
259271 // Mock table schema fetch.
260- when (mockTablesGet .execute ()).thenReturn (tableWithBasicSchema ());
272+ when (mockTablesGet .execute ()).thenReturn (noTableQuerySchema ());
261273
262274 byte [] photoBytes = "photograph" .getBytes ();
263275 String photoBytesEncoded = BaseEncoding .base64 ().encode (photoBytes );
264276 // Mock table data fetch.
265277 when (mockTabledataList .execute ()).thenReturn (
266- rawDataList (rawRow ("Arthur" , 42 , photoBytesEncoded ,
267- "2000-01-01" , "2000-01-01 00:00:00.000005" , "00:00:00.000005" )));
278+ rawDataList (rawRow ("Arthur" , 42 , photoBytesEncoded )));
268279
269280 // Run query and verify
270281 String query = String .format (
@@ -277,10 +288,10 @@ public void testReadFromQueryNoTables() throws IOException, InterruptedException
277288 TableRow row = iterator .getCurrent ();
278289
279290 assertTrue (row .containsKey ("name" ));
280- assertTrue (row .containsKey ("answer " ));
291+ assertTrue (row .containsKey ("count " ));
281292 assertTrue (row .containsKey ("photo" ));
282293 assertEquals ("Arthur" , row .get ("name" ));
283- assertEquals (42 , row .get ("answer " ));
294+ assertEquals (42 , row .get ("count " ));
284295 assertEquals (photoBytesEncoded , row .get ("photo" ));
285296
286297 assertFalse (iterator .advance ());
0 commit comments