@Test public void apply_ShouldReturnDefaultProfile_IfFileFoundAndParsable() throws Exception { Path profileFile = createFile(profileFolder.resolve("default.ffmpeg")); when(parser.parseFile(profileFile)).thenReturn(Optional.of(profile)); assertThat(subject.apply(candidate)).hasValue(profile); }
@Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profileFile = profileScanConfig.profile_base_dir().resolve( profileScanConfig.default_profile_file_name() + profileScanConfig.profile_file_name_extension()); if (Files.exists(profileFile)) { return log.exit(parser.parseFile(profileFile)); } else { log.warn("Default profile file {} does not exist.", profileFile); return log.exit(Optional.empty()); } }
DefaultProfileMatcher implements ProfileMatcher { @Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profileFile = profileScanConfig.profile_base_dir().resolve( profileScanConfig.default_profile_file_name() + profileScanConfig.profile_file_name_extension()); if (Files.exists(profileFile)) { return log.exit(parser.parseFile(profileFile)); } else { log.warn("Default profile file {} does not exist.", profileFile); return log.exit(Optional.empty()); } } }
DefaultProfileMatcher implements ProfileMatcher { @Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profileFile = profileScanConfig.profile_base_dir().resolve( profileScanConfig.default_profile_file_name() + profileScanConfig.profile_file_name_extension()); if (Files.exists(profileFile)) { return log.exit(parser.parseFile(profileFile)); } else { log.warn("Default profile file {} does not exist.", profileFile); return log.exit(Optional.empty()); } } @Inject  DefaultProfileMatcher(ProfileScanConfig profileScanConfig,
                          ProfileParser parser); }
DefaultProfileMatcher implements ProfileMatcher { @Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profileFile = profileScanConfig.profile_base_dir().resolve( profileScanConfig.default_profile_file_name() + profileScanConfig.profile_file_name_extension()); if (Files.exists(profileFile)) { return log.exit(parser.parseFile(profileFile)); } else { log.warn("Default profile file {} does not exist.", profileFile); return log.exit(Optional.empty()); } } @Inject  DefaultProfileMatcher(ProfileScanConfig profileScanConfig,
                          ProfileParser parser); @Override Optional<Profile> apply(Media candidate); }
DefaultProfileMatcher implements ProfileMatcher { @Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profileFile = profileScanConfig.profile_base_dir().resolve( profileScanConfig.default_profile_file_name() + profileScanConfig.profile_file_name_extension()); if (Files.exists(profileFile)) { return log.exit(parser.parseFile(profileFile)); } else { log.warn("Default profile file {} does not exist.", profileFile); return log.exit(Optional.empty()); } } @Inject  DefaultProfileMatcher(ProfileScanConfig profileScanConfig,
                          ProfileParser parser); @Override Optional<Profile> apply(Media candidate);  }