@Test public void testCaseInsensitiveExtension() { when(mockFile.getName()).thenReturn("bla.PdF"); assertTrue(victim.isValid(mockFile, null)); }
@Override public boolean isValid(File value, ConstraintValidatorContext context) { if (value != null && value.isFile()) { String extension = FilenameUtils.getExtension(value.getName()); return equalsIgnoreCase(expectedExtension, extension) && indexOfExtension(value.getName()) > 0; } return true; }
FileExtensionValidator implements ConstraintValidator<FileExtension, File> { @Override public boolean isValid(File value, ConstraintValidatorContext context) { if (value != null && value.isFile()) { String extension = FilenameUtils.getExtension(value.getName()); return equalsIgnoreCase(expectedExtension, extension) && indexOfExtension(value.getName()) > 0; } return true; } }
FileExtensionValidator implements ConstraintValidator<FileExtension, File> { @Override public boolean isValid(File value, ConstraintValidatorContext context) { if (value != null && value.isFile()) { String extension = FilenameUtils.getExtension(value.getName()); return equalsIgnoreCase(expectedExtension, extension) && indexOfExtension(value.getName()) > 0; } return true; }  }
FileExtensionValidator implements ConstraintValidator<FileExtension, File> { @Override public boolean isValid(File value, ConstraintValidatorContext context) { if (value != null && value.isFile()) { String extension = FilenameUtils.getExtension(value.getName()); return equalsIgnoreCase(expectedExtension, extension) && indexOfExtension(value.getName()) > 0; } return true; }  @Override void initialize(FileExtension constraintAnnotation); @Override boolean isValid(File value, ConstraintValidatorContext context); }
FileExtensionValidator implements ConstraintValidator<FileExtension, File> { @Override public boolean isValid(File value, ConstraintValidatorContext context) { if (value != null && value.isFile()) { String extension = FilenameUtils.getExtension(value.getName()); return equalsIgnoreCase(expectedExtension, extension) && indexOfExtension(value.getName()) > 0; } return true; }  @Override void initialize(FileExtension constraintAnnotation); @Override boolean isValid(File value, ConstraintValidatorContext context);  }