@@ -146,12 +146,12 @@ public void toRealPath() throws Exception {
146
146
// from VFS
147
147
for (FileSystem fs : new FileSystem []{rwHostIOVFS , rHostIOVFS , noHostIOVFS }) {
148
148
// check regular resource dir
149
- assertEquals (VFS_MOUNT_POINT + File .separator + "dir1" , fs .toRealPath (Path .of (VFS_MOUNT_POINT + File .separator + "dir1" )). toString ( ));
149
+ assertEquals (Path . of ( VFS_MOUNT_POINT + File .separator + "dir1" ) , fs .toRealPath (Path .of (VFS_MOUNT_POINT + File .separator + "dir1" )));
150
150
// check regular resource file
151
- assertEquals (VFS_MOUNT_POINT + File .separator + "SomeFile" , fs .toRealPath (Path .of (VFS_MOUNT_POINT + File .separator + "SomeFile" )). toString ( ));
151
+ assertEquals (Path . of ( VFS_MOUNT_POINT + File .separator + "SomeFile" ) , fs .toRealPath (Path .of (VFS_MOUNT_POINT + File .separator + "SomeFile" )));
152
152
// check to be extracted file
153
153
checkExtractedFile (fs .toRealPath (Path .of (VFS_MOUNT_POINT + File .separator + "extractme" )), new String []{"text1" , "text2" });
154
- assertEquals (VFS_MOUNT_POINT + File .separator + "does-not-exist/extractme" , fs .toRealPath (Path .of (VFS_MOUNT_POINT + File .separator + "does-not-exist/extractme" )). toString ( ));
154
+ assertEquals (Path . of ( VFS_MOUNT_POINT + File .separator + "does-not-exist/extractme" ) , fs .toRealPath (Path .of (VFS_MOUNT_POINT + File .separator + "does-not-exist/extractme" )));
155
155
}
156
156
157
157
// from real FS
@@ -168,13 +168,13 @@ public void toAbsolutePath() throws Exception {
168
168
// from VFS
169
169
for (FileSystem fs : new FileSystem []{rwHostIOVFS , rHostIOVFS , noHostIOVFS }) {
170
170
// check regular resource dir
171
- assertEquals (VFS_MOUNT_POINT + File .separator + "dir1" , fs .toAbsolutePath (Path .of (VFS_MOUNT_POINT + File .separator + "dir1" )). toString ( ));
171
+ assertEquals (Path . of ( VFS_MOUNT_POINT + File .separator + "dir1" ) , fs .toAbsolutePath (Path .of (VFS_MOUNT_POINT + File .separator + "dir1" )));
172
172
// check regular resource file
173
- assertEquals (VFS_MOUNT_POINT + File .separator + "SomeFile" , fs .toAbsolutePath (Path .of (VFS_MOUNT_POINT + File .separator + "SomeFile" )). toString ( ));
173
+ assertEquals (Path . of ( VFS_MOUNT_POINT + File .separator + "SomeFile" ) , fs .toAbsolutePath (Path .of (VFS_MOUNT_POINT + File .separator + "SomeFile" )));
174
174
// check to be extracted file
175
175
checkExtractedFile (fs .toAbsolutePath (Path .of (VFS_MOUNT_POINT + File .separator + "extractme" )), new String []{"text1" , "text2" });
176
176
checkExtractedFile (fs .toAbsolutePath (Path .of (VFS_MOUNT_POINT + File .separator + "dir1/extractme" )), null );
177
- assertEquals (VFS_MOUNT_POINT + File .separator + "does-not-exist/extractme" , fs .toAbsolutePath (Path .of (VFS_MOUNT_POINT + File .separator + "does-not-exist/extractme" )). toString ( ));
177
+ assertEquals (Path . of ( VFS_MOUNT_POINT + File .separator + "does-not-exist/extractme" ) , fs .toAbsolutePath (Path .of (VFS_MOUNT_POINT + File .separator + "does-not-exist/extractme" )));
178
178
}
179
179
180
180
// from real FS
@@ -364,8 +364,7 @@ public void newByteChannel() throws IOException {
364
364
ByteBuffer buffer = ByteBuffer .allocate (1024 );
365
365
bch .read (buffer );
366
366
String s = new String (buffer .array ());
367
-
368
- String [] ss = s .split ("\n " );
367
+ String [] ss = s .split (System .lineSeparator ());
369
368
assertTrue (ss .length >= 2 );
370
369
assertEquals ("text1" , ss [0 ]);
371
370
assertEquals ("text2" , ss [1 ]);
@@ -391,7 +390,7 @@ public void newByteChannel() throws IOException {
391
390
ByteBuffer buffer = ByteBuffer .allocate (4 );
392
391
bch .read (buffer );
393
392
String s = new String (buffer .array ());
394
- String [] ss = s .split (" \n " );
393
+ String [] ss = s .split (System . lineSeparator () );
395
394
assertTrue (ss .length >= 1 );
396
395
assertEquals ("text" , ss [0 ]);
397
396
}
@@ -413,8 +412,8 @@ public void newDirectoryStream() throws Exception {
413
412
s .add (p .toString ());
414
413
}
415
414
assertEquals (2 , s .size ());
416
- assertTrue (s .contains (VFS_MOUNT_POINT + File .separator + "dir1/ extractme" ));
417
- assertTrue (s .contains (VFS_MOUNT_POINT + File .separator + "dir1/ file2" ));
415
+ assertTrue (s .contains (VFS_MOUNT_POINT + File .separator + "dir1" + File . separator + " extractme" ));
416
+ assertTrue (s .contains (VFS_MOUNT_POINT + File .separator + "dir1" + File . separator + " file2" ));
418
417
419
418
ds = fs .newDirectoryStream (Path .of (VFS_MOUNT_POINT + File .separator + "dir1" ), (p ) -> false );
420
419
assertFalse (ds .iterator ().hasNext ());
@@ -730,8 +729,8 @@ assert len(dirs) == 8, 'expected 8 dirs, got ' + str(len(dirs))
730
729
with open("/test_mount_point/file1", "r") as f:
731
730
l = f.readlines()
732
731
assert len(l) == 2, 'expect 2 lines, got ' + len(l)
733
- assert l[0] == "text1\\ n", 'expected "text1", got ' + l[0]
734
- assert l[1] == "text2\\ n", 'expected "text2", got ' + l[1]
732
+ assert l[0].startswith( "text1"), f 'expected "text1", got "{ l[0]}"'
733
+ assert l[1].startswith( "text2"), f 'expected "text2", got "{ l[1]}"'
735
734
736
735
with open("/test_mount_point/dir1/file2", "r") as f:
737
736
l = f.readlines()
0 commit comments