Skip to content

Commit 5158b71

Browse files
author
duke
committed
Backport 46b5e588ab18a68d164b1d97e71d769585c7c4b8
1 parent 8fd9a73 commit 5158b71

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

test/jdk/java/nio/file/FileStore/Basic.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import jdk.test.lib.Platform;
4040
import jdk.test.lib.util.FileUtils;
41+
import static jdk.test.lib.Asserts.*;
4142

4243
public class Basic {
4344

@@ -52,11 +53,6 @@ public static void main(String[] args) throws IOException {
5253
}
5354
}
5455

55-
static void assertTrue(boolean okay) {
56-
if (!okay)
57-
throw new RuntimeException("Assertion failed");
58-
}
59-
6056
static void checkWithin1GB(String space, long expected, long actual) {
6157
long diff = Math.abs(actual - expected);
6258
if (diff > G) {
@@ -73,8 +69,11 @@ static <V extends FileAttributeView> void testFileAttributes(Path file,
7369
FileStore store = Files.getFileStore(file);
7470
boolean supported = store.supportsFileAttributeView(viewClass);
7571
assertTrue(store.supportsFileAttributeView(viewName) == supported);
76-
boolean haveView = Files.getFileAttributeView(file, viewClass) != null;
77-
assertTrue(haveView == supported);
72+
// If the file attribute view is supported by the FileStore then
73+
// Files.getFileAttributeView should return that view
74+
if (supported) {
75+
assertNotNull(Files.getFileAttributeView(file, viewClass));
76+
}
7877
}
7978

8079
static void doTests(Path dir) throws IOException {

0 commit comments

Comments
 (0)