### Question:
RegistryActionFunction { public Try<FileInputStream> tryStreamFileSubjects() { File file = new File(this.config.getString("avro.subjects.yaml")); return Try .ofFailable(() -> new FileInputStream(file)) .onFailure((t) -> logger.error("Fail to load the yaml file, it may not exist.", t)); } RegistryActionFunction(Config config);  RegistryActionFunction(Config config, SchemaRegistryClient schemaRegistryClient); Yaml getYaml(); SchemaRegistryClient getClient(); Schema.Parser getParser(); Try<FileInputStream> tryStreamFileSubjects(); Try<List<SchemaList.SubjectEntry>> parseYaml(FileInputStream input); List<KeyValuePair<String, File>> mapSubjectToFile(List<SchemaList.SubjectEntry> subjects); Try<KeyValuePair<String, Schema>> parseOne(KeyValuePair<String, File> subjectFilePair); Try<List<KeyValuePair<String, Schema>>> parseAll(List<KeyValuePair<String, File>> subjectFilePairs); Try<KeyValuePair<String, Boolean>> testOne(KeyValuePair<String, Schema> subjectSchemaPair); Try<List<KeyValuePair<String, Boolean>>> testAll(List<KeyValuePair<String, Schema>> subjectSchemaPairs); Try<Stream<T>> travers(List<Try<T>> tries); static Predicate<R> not(Predicate<R> predicate);  }### Answer:
@Test void tryStreamFileSubjectsShouldLoadExistingFile() throws IOException { Try<FileInputStream> triedInputStream = service.tryStreamFileSubjects(); assertTrue(triedInputStream.isSuccess()); ByteBuffer buffer = ByteBuffer.wrap(new byte[64]); triedInputStream.getUnchecked().getChannel().read(buffer); assertEquals(byteToUTF8(buffer).split("\n")[0], "---"); assertEquals(byteToUTF8(buffer).split("\n")[1], "schemas:"); }
@Test void tryStreamFileSubjectsShouldFailOnMissingFile() { Config config = ConfigFactory .parseResources("application-test.conf") .withValue("avro.subjects.yaml", ConfigValueFactory.fromAnyRef("/totally/fake/path/to.yaml")); service = new RegistryActionFunction(config); Try<FileInputStream> triedInputStream = service.tryStreamFileSubjects(); assertFalse(triedInputStream.isSuccess()); triedInputStream .onFailure((throwable) -> assertThat(throwable, instanceOf(FileNotFoundException.class))); }