@Test public void testFind() { assertEquals(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), new UploadTargetFinder(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume))).find(null)); assertEquals(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), new UploadTargetFinder(new Path("/", EnumSet.of(Path.Type.directory))) .find(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)))); assertEquals(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)), new UploadTargetFinder(new Path("/", EnumSet.of(Path.Type.directory))) .find(new Path("/f", EnumSet.of(Path.Type.file)))); assertEquals(new Path("/d", EnumSet.of(Path.Type.directory)), new UploadTargetFinder(new Path("/", EnumSet.of(Path.Type.directory))) .find(new Path("/d/f", EnumSet.of(Path.Type.file)))); assertEquals(new Path("/d", EnumSet.of(Path.Type.directory)), new UploadTargetFinder(new Path("/", EnumSet.of(Path.Type.directory))) .find(new Path("/d/f", EnumSet.of(Path.Type.directory)))); }
public Path find(final Path selected) { if(null == selected) { return workdir; } if(selected.getType().contains(Path.Type.volume)) { return selected; } return selected.getParent(); }
UploadTargetFinder { public Path find(final Path selected) { if(null == selected) { return workdir; } if(selected.getType().contains(Path.Type.volume)) { return selected; } return selected.getParent(); } }
UploadTargetFinder { public Path find(final Path selected) { if(null == selected) { return workdir; } if(selected.getType().contains(Path.Type.volume)) { return selected; } return selected.getParent(); } UploadTargetFinder(final Path workdir); }
UploadTargetFinder { public Path find(final Path selected) { if(null == selected) { return workdir; } if(selected.getType().contains(Path.Type.volume)) { return selected; } return selected.getParent(); } UploadTargetFinder(final Path workdir); Path find(final Path selected); }
UploadTargetFinder { public Path find(final Path selected) { if(null == selected) { return workdir; } if(selected.getType().contains(Path.Type.volume)) { return selected; } return selected.getParent(); } UploadTargetFinder(final Path workdir); Path find(final Path selected);  }