@Test public void accept_ShouldReturnFalse_IfRegexOnlyMatchesPartially() throws Exception { when(candidate.getSourcePath()).thenReturn(getPath("input", "movie.mp4")); when(config.filename_regex()).thenReturn(".mp4"); subject = new FileNameConstraint(config); assertThat(subject.accept(candidate)).isFalse(); }
@Override public boolean accept(Media candidate) { String toTest = candidate.getSourcePath().toString(); return logAndReturnResult(pattern.matcher(toTest).matches(), "file name of {} with regex {}", candidate.getSourcePath(), pattern.pattern()); }
FileNameConstraint extends AbstractConstraint { @Override public boolean accept(Media candidate) { String toTest = candidate.getSourcePath().toString(); return logAndReturnResult(pattern.matcher(toTest).matches(), "file name of {} with regex {}", candidate.getSourcePath(), pattern.pattern()); } }
FileNameConstraint extends AbstractConstraint { @Override public boolean accept(Media candidate) { String toTest = candidate.getSourcePath().toString(); return logAndReturnResult(pattern.matcher(toTest).matches(), "file name of {} with regex {}", candidate.getSourcePath(), pattern.pattern()); } @Inject  FileNameConstraint(ConstraintConfig config); }
FileNameConstraint extends AbstractConstraint { @Override public boolean accept(Media candidate) { String toTest = candidate.getSourcePath().toString(); return logAndReturnResult(pattern.matcher(toTest).matches(), "file name of {} with regex {}", candidate.getSourcePath(), pattern.pattern()); } @Inject  FileNameConstraint(ConstraintConfig config); @Override boolean accept(Media candidate); }
FileNameConstraint extends AbstractConstraint { @Override public boolean accept(Media candidate) { String toTest = candidate.getSourcePath().toString(); return logAndReturnResult(pattern.matcher(toTest).matches(), "file name of {} with regex {}", candidate.getSourcePath(), pattern.pattern()); } @Inject  FileNameConstraint(ConstraintConfig config); @Override boolean accept(Media candidate);  }