FileUtil { public static boolean configurePermissions(final File f, final boolean executable) { var ownerOnly = true; return f.setWritable(true, ownerOnly) && f.setReadable(true, ownerOnly) && f.setExecutable(executable, ownerOnly); } private  FileUtil(); static boolean configurePermissions(final File f, final boolean executable); static boolean isJarFile(final File f); static Either<Exception, Optional<File>> findFolder(final String folderName); static Stream<URL> filesToUrls(final File... jars);  }
@DisabledOnOs(OS.WINDOWS) @Test void permissions() throws IOException { File file = createTempFile(); Path path = file.toPath(); boolean result = FileUtil.configurePermissions(file, true); assertSoftly(softly -> { softly.assertThat(path.toFile()) .canRead() .canWrite(); softly.assertThat(path.toFile() .canExecute()) .isTrue(); softly.assertThat(result) .isTrue(); }); boolean result2 = FileUtil.configurePermissions(file, false); assertSoftly(softly -> { softly.assertThat(path.toFile()) .canRead() .canWrite(); softly.assertThat(path.toFile() .canExecute()) .isFalse(); softly.assertThat(result2) .isTrue(); }); }