mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 13:19:02 +00:00
16 lines
541 B
Java
16 lines
541 B
Java
![]() |
package nu.marginalia.test;
|
||
|
|
||
|
import java.nio.charset.StandardCharsets;
|
||
|
|
||
|
public class CommonTestData {
|
||
|
public static String loadTestData(String path) {
|
||
|
try (var resourceStream = CommonTestData.class.getClassLoader().getResourceAsStream(path)) {
|
||
|
if (resourceStream == null) throw new IllegalArgumentException("No such resource: " + path);
|
||
|
|
||
|
return new String(resourceStream.readAllBytes(), StandardCharsets.UTF_8);
|
||
|
} catch (Exception e) {
|
||
|
throw new RuntimeException(e);
|
||
|
}
|
||
|
}
|
||
|
}
|