### Question:
Loader { public void write(String destination) { df.write().format("com.databricks.spark.csv").option("codec", "org.apache.hadoop.io.compress.GzipCodec").option("header", "true").mode("overwrite").save(configuration.getFileSystem() + ": } Loader(Region region);  Loader(String app, String master, String warehouse); SparkSession getSparkSession(); void setConfiguration(Configuration configuration); void setDf(Dataset df); void loadSourceFiles(Mapping mapping); Dataset<Row> loadDf(InputStream stream); void teardown(String stack, Region region); void load(Configuration configuration); void write(String destination); void write(String destination, List<String> overflowColumns); void addMetadata(String destination); void materializeUUID(String prefix, String suffix);  }### Answer:
@Test public void testWrite() throws IOException { Mapping mapping = configuration.getMappings().get(1); Dataset<Row> data; loader.setConfiguration(configuration); loader.loadSourceFiles(mapping); loader.setDf(loader.loadDf(getClass().getResourceAsStream("write.sql"))); loader.write("testwrite"); data = loader.getSparkSession().read().format("com.databricks.spark.csv").option("header", "true").option("inferSchema", "false").option("nullValue", "").option("treatEmptyValuesAsNulls","true").load(configuration.getFileSystem() + ": assertEquals("Doctor A", data.first().get(0)); assertEquals("1", data.first().get(1)); assertEquals("ED", data.first().get(2)); assertEquals("Patient 2", data.first().get(3)); FileUtils.deleteDirectory(new File("/tmp/testwrite.csv")); }