Skip to content

Commit c02b5df

Browse files
committed
Improved path resolution and fixed typo.
1 parent eabd9b1 commit c02b5df

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/test/java/org/apache/datasketches/common/TestUtil.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*/
3030
public final class TestUtil {
3131

32+
private static final String userDir = System.getProperty("user.dir");
33+
3234
/**
3335
* TestNG group constants
3436
*/
@@ -41,27 +43,27 @@ public final class TestUtil {
4143
/**
4244
* The project relative Path for Java serialized sketches to be tested by other languages.
4345
*/
44-
public static final Path javaPath = Path.of(".", "serialization_test_data", "java_generated_files");
46+
public static final Path javaPath = Path.of(userDir, "serialization_test_data", "java_generated_files").normalize();
4547

4648
/**
4749
* The project relative Path for C++ serialized sketches to be tested by Java.
4850
*/
49-
public static final Path cppPath = Path.of(".", "serialization_test_data", "cpp_generated_files");
51+
public static final Path cppPath = Path.of(userDir, "serialization_test_data", "cpp_generated_files").normalize();
5052

5153
/**
5254
* The project relative Path for Go serialized sketches to be tested by Java.
5355
*/
54-
public static final Path goPath = Path.of(".", "serialization_test_data", "go_generated_files");
56+
public static final Path goPath = Path.of(userDir, "serialization_test_data", "go_generated_files").normalize();
5557

5658
/**
5759
* The project relative Path for Rust serialized sketches to be tested by Java.
5860
*/
59-
public static final Path rustPath = Path.of(".", "serialization_test_data", "rust_generated_files");
61+
public static final Path rustPath = Path.of(userDir, "serialization_test_data", "rust_generated_files").normalize();
6062

6163
/**
6264
* The project relative Path for /src/test/resources
6365
*/
64-
public static final Path resPath = Path.of(".","src","test","resources");
66+
public static final Path resPath = Path.of(userDir,"src","test","resources").normalize();
6567

6668
public enum Existence { MUST_EXIST, WARNING }
6769

@@ -73,7 +75,7 @@ public enum Existence { MUST_EXIST, WARNING }
7375
* @param fileName the simple file name of the file
7476
* @param option an optional parameter. If option == Existence.MUST_EXIST and the file does not exist an exception will be thrown.
7577
* If option == Existence.WARNING, or not given, and the file does not exist, it writes a warning message
76-
* to {@link System.err.out System.err.out}.
78+
* to {@link System.err System.err}.
7779
* If option has more than one argument an exception will be thrown.
7880
* @return a byte array. It may be empty.
7981
* @throws RuntimeException for IO errors, or if resolved path is not a file or not readable or optionally not found.

0 commit comments

Comments
 (0)