/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 4313887 6838333 8005566
* @summary Unit test for miscellenous methods in java.nio.file.Files
* @library ..
*/
public class Misc {
try {
} finally {
}
}
/**
* Tests createDirectories
*/
// a no-op
// create one directory
// create parents
// existing file is not a directory
try {
throw new RuntimeException("failure expected");
} catch (FileAlreadyExistsException x) { }
try {
throw new RuntimeException("failure expected");
} catch (IOException x) { }
}
/**
* Tests isHidden
*/
try {
try {
} finally {
}
} finally {
}
} else {
}
}
/**
* Tests isSameFile
*/
/**
* Test: isSameFile for self
*/
/**
* Test: Neither files exist
*/
try {
throw new RuntimeException("IOException not thrown");
} catch (IOException x) {
}
try {
throw new RuntimeException("IOException not thrown");
} catch (IOException x) {
}
try {
/**
* Test: One file exists
*/
try {
throw new RuntimeException("IOException not thrown");
} catch (IOException x) {
}
try {
throw new RuntimeException("IOException not thrown");
} catch (IOException x) {
}
/**
* Test: Both file exists
*/
try {
} finally {
}
/**
* Test: Symbolic links
*/
try {
} finally {
}
}
} finally {
}
// nulls
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
try {
throw new RuntimeException("NullPointerException expected");
} catch (NullPointerException ignore) { }
}
/**
* Exercise isRegularFile, isDirectory, isSymbolicLink
*/
try {
try {
} finally {
}
try {
} finally {
}
try {
} finally {
}
}
} finally {
}
}
/**
* Exercise isReadbale, isWritable, isExecutable, exists, notExists
*/
// should return false when file does not exist
try {
// files exist
// sym link exists
try {
} finally {
}
try {
} finally {
}
}
/**
* Test: Edit ACL to deny WRITE and EXECUTE
*/
// Insert entry to deny WRITE and EXECUTE
.build();
try {
} finally {
// Restore ACL
}
}
/**
* Test: Windows DOS read-only attribute
*/
try {
} finally {
}
// Read-only attribute does not make direcory read-only
view.setReadOnly(true);
try {
} finally {
}
}
} finally {
}
}
if (!okay)
throw new RuntimeException("Assertion Failed");
}
}