summaryrefslogtreecommitdiff
path: root/src/test/java/org/javacs/FindResource.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/javacs/FindResource.java')
-rw-r--r--src/test/java/org/javacs/FindResource.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/java/org/javacs/FindResource.java b/src/test/java/org/javacs/FindResource.java
index ce07a04..6e6860e 100644
--- a/src/test/java/org/javacs/FindResource.java
+++ b/src/test/java/org/javacs/FindResource.java
@@ -1,8 +1,11 @@
package org.javacs;
+import java.io.IOException;
import java.net.URI;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.List;
/** Find java sources in test-project/workspace/src */
public class FindResource {
@@ -12,6 +15,17 @@ public class FindResource {
return path.toUri();
}
+ public static String contents(String resourcePath) {
+ var path = path(resourcePath);
+ List<String> lines;
+ try {
+ lines = Files.readAllLines(path);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return String.join("\n", lines);
+ }
+
public static Path path(String resourcePath) {
if (resourcePath.startsWith("/")) resourcePath = resourcePath.substring(1);