Read a file in from a resource. In many cases it is useful to read it into a string. Use a standard Maven directory layout.
├───src
│ ├───main
│ │ ├───java
│ │ └───resources
│ └───test
│ ├───java
│ └───resources
URL url = getClass().getClassLoader().getResource("test.txt");
Path path = Paths.get(url.toURI());
String contents = new String(Files.readAllBytes(path));