@Test public void apply_ShouldReturnProfile_IfFileFoundAndReadable() throws Exception { Path media = createParentDirOf(getPath("input", "movie.mp4")); createFile(getPath("input", "movie.mp4.ffmpeg")); when(candidate.getSourcePath()).thenReturn(media); Profile result = subject.apply(candidate).get(); assertThat(result).isEqualTo(profile); }
@Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profile = candidate.getSourcePath().resolveSibling( candidate.getSourcePath().getFileName() + scanConfig.profile_file_name_extension()); if (Files.exists(profile)) { return log.exit(profileParser.parseFile(profile)); } else { log.debug("Companion file {} does not exist.", profile); return log.exit(Optional.empty()); } }
CompanionProfileMatcher implements ProfileMatcher { @Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profile = candidate.getSourcePath().resolveSibling( candidate.getSourcePath().getFileName() + scanConfig.profile_file_name_extension()); if (Files.exists(profile)) { return log.exit(profileParser.parseFile(profile)); } else { log.debug("Companion file {} does not exist.", profile); return log.exit(Optional.empty()); } } }
CompanionProfileMatcher implements ProfileMatcher { @Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profile = candidate.getSourcePath().resolveSibling( candidate.getSourcePath().getFileName() + scanConfig.profile_file_name_extension()); if (Files.exists(profile)) { return log.exit(profileParser.parseFile(profile)); } else { log.debug("Companion file {} does not exist.", profile); return log.exit(Optional.empty()); } } @Inject  CompanionProfileMatcher(ProfileScanConfig scanConfig,
                            ProfileParser profileParser); }
CompanionProfileMatcher implements ProfileMatcher { @Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profile = candidate.getSourcePath().resolveSibling( candidate.getSourcePath().getFileName() + scanConfig.profile_file_name_extension()); if (Files.exists(profile)) { return log.exit(profileParser.parseFile(profile)); } else { log.debug("Companion file {} does not exist.", profile); return log.exit(Optional.empty()); } } @Inject  CompanionProfileMatcher(ProfileScanConfig scanConfig,
                            ProfileParser profileParser); @Override Optional<Profile> apply(Media candidate); }
CompanionProfileMatcher implements ProfileMatcher { @Override public Optional<Profile> apply(Media candidate) { log.entry(candidate); Path profile = candidate.getSourcePath().resolveSibling( candidate.getSourcePath().getFileName() + scanConfig.profile_file_name_extension()); if (Files.exists(profile)) { return log.exit(profileParser.parseFile(profile)); } else { log.debug("Companion file {} does not exist.", profile); return log.exit(Optional.empty()); } } @Inject  CompanionProfileMatcher(ProfileScanConfig scanConfig,
                            ProfileParser profileParser); @Override Optional<Profile> apply(Media candidate);  }