### Question:
GenerateSchemas { public static int main(String[] args) { if (args.length < 2) { System.out.println("Usage: GenerateSchemas <output file> resourceTypeUrls..."); System.out.println("Example:"); System.out.println(" GenerateSchemas my_schemas.avsc " + "http: + "http: System.out.println(); System.out.println("The resulting avsc file then can be used to generate Java classes " + "using avro-tools, for example:"); System.out.println(" avro-tools compile protocol my_schemas.avsc <target_directory>"); return 1; } File outputFile = new File(args[0]); if (outputFile.exists()) { System.out.println("File " + outputFile.getName() + " already exists."); return 1; } Map<String, List<String>> resourceTypeUrls = Arrays.stream(args) .skip(1) .collect(Collectors.toMap(Function.identity(), item -> Collections.emptyList())); List<Schema> schemas = AvroConverter.generateSchemas(FhirContexts.forStu3(), resourceTypeUrls); Protocol protocol = new Protocol("FhirGeneratedSchemas", "Avro schemas generated from FHIR StructureDefinitions", "com.cerner.bunsen.avro"); protocol.setTypes(schemas); try { Files.write(outputFile.toPath(), protocol.toString(true).getBytes()); } catch (IOException exception) { System.out.println("Unable to write file " + outputFile.getPath()); exception.printStackTrace(); return 1; } return 0; }  static int main(String[] args);  }### Answer:
@Test public void testWriteSchema() throws IOException { Path generatedCodePath = Files.createTempDirectory("schema_directory"); generatedCodePath.toFile().deleteOnExit(); Path outputFile = generatedCodePath.resolve("out.asvc"); int result = GenerateSchemas.main(new String[] {outputFile.toString(), TestData.US_CORE_PATIENT, TestData.US_CORE_CONDITION, TestData.US_CORE_MEDICATION, TestData.US_CORE_MEDICATION_REQUEST}); Assert.assertEquals(0, result); Assert.assertTrue(outputFile.toFile().exists()); }