BigQueryOutputConfiguration { public static BigQueryFileFormat getFileFormat(Configuration conf) throws IOException { String fileFormatName = getMandatoryConfig(conf, OUTPUT_FILE_FORMAT); return BigQueryFileFormat.fromName(fileFormatName); }  @SuppressWarnings("rawtypes") static void configure(
      Configuration conf,
      String qualifiedOutputTableId,
      String outputTableSchemaJson,
      String outputGcsPath,
      BigQueryFileFormat outputFileFormat,
      Class<? extends FileOutputFormat> outputFormatClass); @SuppressWarnings("rawtypes") static void configure(
      Configuration conf,
      String qualifiedOutputTableId,
      BigQueryTableSchema outputTableSchema,
      String outputGcsPath,
      BigQueryFileFormat outputFileFormat,
      Class<? extends FileOutputFormat> outputFormatClass); @SuppressWarnings("rawtypes") static void configureWithAutoSchema(
      Configuration conf,
      String qualifiedOutputTableId,
      String outputGcsPath,
      BigQueryFileFormat outputFileFormat,
      Class<? extends FileOutputFormat> outputFormatClass); static void setKmsKeyName(Configuration conf, String kmsKeyName); static void validateConfiguration(Configuration conf); static boolean getCleanupTemporaryDataFlag(Configuration conf); static String getProjectId(Configuration conf); static String getJobProjectId(Configuration conf); static String getKmsKeyName(Configuration conf); static BigQueryFileFormat getFileFormat(Configuration conf); @SuppressWarnings("rawtypes") static FileOutputFormat getFileOutputFormat(Configuration conf); static Path getGcsOutputPath(Configuration conf); static String getCreateDisposition(Configuration conf); static String getWriteDisposition(Configuration conf); static final List<HadoopConfigurationProperty<?>> REQUIRED_PROPERTIES; }
@Test public void testGetFileFormat() throws IOException { conf.set(BigQueryConfiguration.OUTPUT_FILE_FORMAT.getKey(), TEST_FILE_FORMAT.name()); BigQueryFileFormat result = BigQueryOutputConfiguration.getFileFormat(conf); assertThat(result).isEqualTo(TEST_FILE_FORMAT); }
@Test public void testGetFileFormatMissing() throws IOException { assertThrows(IOException.class, () -> BigQueryOutputConfiguration.getFileFormat(conf)); }
@Test public void testGetFileFormatMalformed() throws IOException { conf.set( BigQueryConfiguration.OUTPUT_FILE_FORMAT.getKey(), Ascii.toLowerCase(TEST_FILE_FORMAT.name())); assertThrows( IllegalArgumentException.class, () -> BigQueryOutputConfiguration.getFileFormat(conf)); }