@Test public void testDetect() { DefaultPathKindDetector d = new DefaultPathKindDetector(); assertEquals(Path.Type.directory, d.detect(null)); assertEquals(Path.Type.directory, d.detect("/")); assertEquals(Path.Type.directory, d.detect("/a")); assertEquals(Path.Type.directory, d.detect("/a/")); assertEquals(Path.Type.file, d.detect("/a/b.z")); assertEquals(Path.Type.file, d.detect("/a/b.zip")); }
@Override public Path.Type detect(final String path) { if(StringUtils.isBlank(path)) { return Path.Type.directory; } if(path.endsWith(String.valueOf(Path.DELIMITER))) { return Path.Type.directory; } if(StringUtils.isBlank(Path.getExtension(path))) { return Path.Type.directory; } return Path.Type.file; }
DefaultPathKindDetector implements PathKindDetector { @Override public Path.Type detect(final String path) { if(StringUtils.isBlank(path)) { return Path.Type.directory; } if(path.endsWith(String.valueOf(Path.DELIMITER))) { return Path.Type.directory; } if(StringUtils.isBlank(Path.getExtension(path))) { return Path.Type.directory; } return Path.Type.file; } }
DefaultPathKindDetector implements PathKindDetector { @Override public Path.Type detect(final String path) { if(StringUtils.isBlank(path)) { return Path.Type.directory; } if(path.endsWith(String.valueOf(Path.DELIMITER))) { return Path.Type.directory; } if(StringUtils.isBlank(Path.getExtension(path))) { return Path.Type.directory; } return Path.Type.file; }  }
DefaultPathKindDetector implements PathKindDetector { @Override public Path.Type detect(final String path) { if(StringUtils.isBlank(path)) { return Path.Type.directory; } if(path.endsWith(String.valueOf(Path.DELIMITER))) { return Path.Type.directory; } if(StringUtils.isBlank(Path.getExtension(path))) { return Path.Type.directory; } return Path.Type.file; }  @Override Path.Type detect(final String path); }
DefaultPathKindDetector implements PathKindDetector { @Override public Path.Type detect(final String path) { if(StringUtils.isBlank(path)) { return Path.Type.directory; } if(path.endsWith(String.valueOf(Path.DELIMITER))) { return Path.Type.directory; } if(StringUtils.isBlank(Path.getExtension(path))) { return Path.Type.directory; } return Path.Type.file; }  @Override Path.Type detect(final String path);  }