BigQueryTableSchema { public BigQueryTableSchema() { this.tableSchema = new TableSchema(); } BigQueryTableSchema();   BigQueryTableSchema(TableSchema tableSchema); BigQueryTableSchema setFields(List<BigQueryTableFieldSchema> bigQueryTableFields); @Override int hashCode(); @Override boolean equals(Object object);  }
@Test public void testBigQueryTableSchema() throws IOException { ImmutableList<BigQueryTableFieldSchema> fields = ImmutableList.of( new BigQueryTableFieldSchema().setName("Field1").setType("STRING"), new BigQueryTableFieldSchema().setName("Field2").setType("INTEGER"), new BigQueryTableFieldSchema() .setName("Field3") .setType("RECORD") .setFields( ImmutableList.of( new BigQueryTableFieldSchema().setName("NestedField1").setType("STRING"), new BigQueryTableFieldSchema() .setName("NestedField2") .setType("INTEGER")))); BigQueryTableSchema tableSchema = new BigQueryTableSchema().setFields(fields); String json = BigQueryTableHelper.getTableSchemaJson(tableSchema.get()); String expectedJson = "{\"fields\":[{\"name\":\"Field1\",\"type\":\"STRING\"}," + "{\"name\":\"Field2\",\"type\":\"INTEGER\"}," + "{\"fields\":[{\"name\":\"NestedField1\",\"type\":\"STRING\"}," + "{\"name\":\"NestedField2\",\"type\":\"INTEGER\"}]," + "\"name\":\"Field3\",\"type\":\"RECORD\"}]}"; assertThat(json).isEqualTo(expectedJson); }