@Test public void apply_ShouldReturnEmptyProfile_IfFileNotFound() throws Exception { when(parser.parseFile(any())).thenReturn(Optional.empty()); assertThat(subject.apply(candidate)).isEmpty(); }
@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);  }