@Test void matchesTest() { FileDescriptor descriptor1 = new FileDescriptor(); FileDescriptor descriptor2 = new FileDescriptor(); assertFalse(descriptor1.matches(descriptor2)); descriptor1.setDirectory("/Users/kai"); descriptor2.setDirectory("/Users/kai"); assertFalse(descriptor1.matches(descriptor2)); descriptor1.setDirectory("Documents/templates"); descriptor2.setDirectory("Documents/templates"); assertFalse(descriptor1.matches(descriptor2)); descriptor1.setFilename("ContractTemplate.docx"); descriptor2.setFilename("ContractTemplate.xlsx"); assertTrue(descriptor1.matches(descriptor2)); descriptor2.setDirectory("/Users/horst"); assertFalse(descriptor1.matches(descriptor2)); descriptor2.setDirectory("/Users/kai"); descriptor2.setDirectory("Documents/templates/test"); assertFalse(descriptor1.matches(descriptor2)); descriptor2.setDirectory("Documents/templates"); descriptor2.setFilename("ContractTemplate2.xlsx"); assertFalse(descriptor1.matches(descriptor2)); descriptor2.setFilename("ContractTemplate.xls"); assertTrue(descriptor1.matches(descriptor2)); }
public boolean matches(FileDescriptor other) { if (!StringUtils.equals(directory, other.directory)) { return false; } if (!StringUtils.equals(relativePath, other.relativePath)) { return false; } if (filename == null || other.filename == null) { return false; } String filenameWithoutExtension = FilenameUtils.removeExtension(filename).trim().toLowerCase(); String otherFilenameWithoutExtension = FilenameUtils.removeExtension(other.filename).trim().toLowerCase(); return filenameWithoutExtension.equals(otherFilenameWithoutExtension); }
FileDescriptor implements Cloneable { public boolean matches(FileDescriptor other) { if (!StringUtils.equals(directory, other.directory)) { return false; } if (!StringUtils.equals(relativePath, other.relativePath)) { return false; } if (filename == null || other.filename == null) { return false; } String filenameWithoutExtension = FilenameUtils.removeExtension(filename).trim().toLowerCase(); String otherFilenameWithoutExtension = FilenameUtils.removeExtension(other.filename).trim().toLowerCase(); return filenameWithoutExtension.equals(otherFilenameWithoutExtension); } }
FileDescriptor implements Cloneable { public boolean matches(FileDescriptor other) { if (!StringUtils.equals(directory, other.directory)) { return false; } if (!StringUtils.equals(relativePath, other.relativePath)) { return false; } if (filename == null || other.filename == null) { return false; } String filenameWithoutExtension = FilenameUtils.removeExtension(filename).trim().toLowerCase(); String otherFilenameWithoutExtension = FilenameUtils.removeExtension(other.filename).trim().toLowerCase(); return filenameWithoutExtension.equals(otherFilenameWithoutExtension); }  }
FileDescriptor implements Cloneable { public boolean matches(FileDescriptor other) { if (!StringUtils.equals(directory, other.directory)) { return false; } if (!StringUtils.equals(relativePath, other.relativePath)) { return false; } if (filename == null || other.filename == null) { return false; } String filenameWithoutExtension = FilenameUtils.removeExtension(filename).trim().toLowerCase(); String otherFilenameWithoutExtension = FilenameUtils.removeExtension(other.filename).trim().toLowerCase(); return filenameWithoutExtension.equals(otherFilenameWithoutExtension); }  String getDirectory(); void setDirectory(String directory); FileDescriptor setDirectory(Path dir); String getRelativePath(); FileDescriptor setRelativePath(String relativePath); FileDescriptor setRelativePath(Path path); String getFilename(); FileDescriptor setFilename(String filename); @Transient Date getLastUpdate(); long getLastModified(); void setLastModified(long lastModified); FileDescriptor setLastUpdate(Date lastUpdate); @Transient String getCanonicalPathString(); Path getCanonicalPath(); boolean matches(FileDescriptor other); boolean isModified(Path file); @Override boolean equals(Object obj); String getPrimaryKey(); @Override int hashCode(); @Override String toString(); @Override Object clone(); }
FileDescriptor implements Cloneable { public boolean matches(FileDescriptor other) { if (!StringUtils.equals(directory, other.directory)) { return false; } if (!StringUtils.equals(relativePath, other.relativePath)) { return false; } if (filename == null || other.filename == null) { return false; } String filenameWithoutExtension = FilenameUtils.removeExtension(filename).trim().toLowerCase(); String otherFilenameWithoutExtension = FilenameUtils.removeExtension(other.filename).trim().toLowerCase(); return filenameWithoutExtension.equals(otherFilenameWithoutExtension); }  String getDirectory(); void setDirectory(String directory); FileDescriptor setDirectory(Path dir); String getRelativePath(); FileDescriptor setRelativePath(String relativePath); FileDescriptor setRelativePath(Path path); String getFilename(); FileDescriptor setFilename(String filename); @Transient Date getLastUpdate(); long getLastModified(); void setLastModified(long lastModified); FileDescriptor setLastUpdate(Date lastUpdate); @Transient String getCanonicalPathString(); Path getCanonicalPath(); boolean matches(FileDescriptor other); boolean isModified(Path file); @Override boolean equals(Object obj); String getPrimaryKey(); @Override int hashCode(); @Override String toString(); @Override Object clone();  }