### Question:
RegistryActionFunction { public Try<List<SchemaList.SubjectEntry>> parseYaml(FileInputStream input) { return Try .ofFailable(() -> (SchemaList) getYaml().load(input)) .onFailure((t) -> logger.error("Fail to parse the yaml file, it may be corrupted", t)) .map(SchemaList::getSchemas); } 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 parseYamlShouldReturnASubjectSchemaEntry() throws FileNotFoundException { FileInputStream inputStream = new FileInputStream( new File( requireNonNull(getClass().getClassLoader().getResource("schemas.yaml")).getPath() ) ); Try<List<SchemaList.SubjectEntry>> triedSubjectSchemaEntries = service.parseYaml(inputStream); assertTrue(triedSubjectSchemaEntries.isSuccess()); assertEquals(triedSubjectSchemaEntries.getUnchecked().get(0).getFile(), "schema0.avsc"); assertEquals(triedSubjectSchemaEntries.getUnchecked().get(0).getSubject(), "subject1-key"); assertEquals(triedSubjectSchemaEntries.getUnchecked().get(1).getFile(), "schema0.avsc"); assertEquals(triedSubjectSchemaEntries.getUnchecked().get(1).getSubject(), "subject2-key"); }
@Test void parseYamlShouldFailOnCorruptedFiles() throws FileNotFoundException { FileInputStream inputStream = new FileInputStream( new File( requireNonNull(getClass().getClassLoader().getResource("schemas-yaml-corrupted.xml")).getPath() ) ); Try<List<SchemaList.SubjectEntry>> triedSubjectSchemaEntries = service.parseYaml(inputStream); assertFalse(triedSubjectSchemaEntries.isSuccess()); triedSubjectSchemaEntries .onFailure((throwable) -> assertThat(throwable, instanceOf(ScannerException.class))); }