@Override public Path createTempFile(final String prefix, final String suffix, final FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException { return Files.createTempFile(prefix, suffix, attrs); }
public static Path createTempFile(final String prefix, final String suffix, final FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException { return createTempFile(TEMP_PATH, prefix, suffix, attrs); }
public static Path createTempFile(final String prefix, final String suffix, final FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException { return createTempFile(TEMP_PATH, prefix, suffix, attrs); }
@Test(expected = FileAlreadyExistsException.class) public void createLinkIllegalStateException1() { Files.createLink(Files.createTempFile("foo", "bar"), Files.createTempFile("foo", "bar")); }
@Test(expected = FileAlreadyExistsException.class) public void createSymbolicLinkIllegalStateException1() { Files.createSymbolicLink(Files.createTempFile("foo", "bar"), Files.createTempFile("foo", "bar")); }
@Test public void setAttributeInvalidAttr() { final Path path = Files.createTempFile("foo", "bar"); assertThatThrownBy(() -> Files.setAttribute(path, "myattr", null)) .isInstanceOf(IllegalStateException.class) .hasMessage("Condition 'invalid attribute' is invalid!"); }
@Test public void readAttributeInvalid() { final Path path = Files.createTempFile("foo", "bar"); assertThatThrownBy(() -> Files.getAttribute(path, "*")) .isInstanceOf(IllegalArgumentException.class) .hasMessage("*"); }
@Test public void setAttributeInvalidView() { final Path path = Files.createTempFile("foo", "bar"); assertThatThrownBy(() -> Files.setAttribute(path, "advanced:isRegularFile", null)) .isInstanceOf(UnsupportedOperationException.class) .hasMessage("View 'advanced' not available"); }
@Test public void setLastModifiedTimeNull2() { final Path path = Files.createTempFile("foo", "bar"); assertThatThrownBy(() -> Files.setLastModifiedTime(path, null)) .isInstanceOf(NotImplementedException.class); }
@Test public void setAttributeNotImpl() { final Path path = Files.createTempFile("foo", "bar"); assertThatThrownBy(() -> Files.setAttribute(path, "isRegularFile", null)) .isInstanceOf(NotImplementedException.class); }
@Test(expected = NotDirectoryException.class) public void newDirectoryStreamGlobNotDirectoryException() { Files.newDirectoryStream(Files.createTempFile("foo", "bar"), "*.*"); }
@Test(expected = UnsupportedOperationException.class) public void probeContentType() { Files.probeContentType(Files.createTempFile(null, null)); }
@Test public void copyIn2PathNull4() { assertThatThrownBy(() -> Files.copy(Files.newInputStream(Files.createTempFile("foo", "bar")), newTempDir().resolve("my_new_file.txt"), new CopyOption[]{null})) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Parameter named 'opt' should be not null!"); }
@Test public void copyIn2PathInvalidOption() { assertThatThrownBy(() -> Files.copy(Files.newInputStream(Files.createTempFile("foo", "bar")), newTempDir().resolve("my_new_file.txt"), NOFOLLOW_LINKS)) .isInstanceOf(UnsupportedOperationException.class) .hasMessage("NOFOLLOW_LINKS not supported"); }
@Test(expected = IllegalArgumentException.class) public void visitFileFailedNull1() { final Path dir = newTempDir(null); final Path file = Files.createTempFile(dir, "foo", "bar"); simple.visitFileFailed(file, null); }
@Test(expected = IllegalArgumentException.class) public void visitFileNull1() { final Path dir = newTempDir(null); final Path file = Files.createTempFile(dir, "foo", "bar"); simple.visitFile(null, Files.readAttributes(file, BasicFileAttributes.class)); }
@Test public void readAttributesGeneral() { final Path path = Files.createTempFile("foo", "bar"); final BasicFileAttributesImpl attrs = Files.readAttributes(path, BasicFileAttributesImpl.class); assertThat(attrs).isNotNull(); assertThat(attrs.isRegularFile()).isTrue(); assertThat(attrs.isDirectory()).isFalse(); assertThat(attrs.isSymbolicLink()).isFalse(); assertThat(attrs.isOther()).isFalse(); assertThat(attrs.size()).isEqualTo(0L); }
@Test public void readAttributesInvalid() { final Path path = Files.createTempFile("foo", "bar"); assertThat(Files.readAttributes(path, MyAttrs.class)).isNull(); }
@Test public void isReadable() { final Path path = Files.createTempFile("foo", "bar"); assertThat(Files.isReadable(path)).isTrue(); assertThat(Files.isReadable(newTempDir())).isTrue(); assertThat(Files.isReadable(Paths.get("/some/file"))).isFalse(); }
@Test public void isDirectory() { final Path path = Files.createTempFile("foo", "bar"); assertThat(Files.isDirectory(path)).isFalse(); assertThat(Files.isDirectory(newTempDir())).isTrue(); assertThat(Files.isDirectory(Paths.get("/some/file"))).isFalse(); }