ScriptUtils { public static void setScriptsExecutable( File fileOrDir ) { List<File> files = new ArrayList<> (); if( fileOrDir.isDirectory()) files.addAll( Utils.listAllFiles( fileOrDir, true )); else files.add( fileOrDir ); for( File f : files ) f.setExecutable( true ); } private  ScriptUtils(); static Map<String,String> formatExportedVars( Instance instance ); static Map<String,String> formatImportedVars( Instance instance ); static void setScriptsExecutable( File fileOrDir );  }
@Test public void testSetScriptsExecutableOnFile() throws Exception { File f = this.folder.newFile(); Assert.assertFalse( f.canExecute()); ScriptUtils.setScriptsExecutable( f ); Assert.assertTrue( f.canExecute()); }
@Test public void testSetScriptsExecutableOnDirectory() throws Exception { File dir = this.folder.newFolder(); File f = new File( dir, "whatever" ); Assert.assertTrue( f.createNewFile()); Assert.assertFalse( f.canExecute()); ScriptUtils.setScriptsExecutable( dir ); Assert.assertTrue( f.canExecute()); }