ClassPathResourceProvider { public static String getResourceContent(String location) { try (InputStream input = getResourceInputStream(location)) { return IOUtils.toString(input, StandardCharsets.UTF_8); } catch (Exception e) { throw new RuntimeException(e); } }  static String getResourcePath(String location); static String getResourceContent(String location); static List<String> getResourcesContents(String... locations); static InputStream getResourceInputStream(String location); static InputStreamReader getResourceReader(String location);  }
@Test(expected = RuntimeException.class) public void givenPathToResourceThatDoesNotExist_whenGetResourceContentIsCalled_thenExceptionIsThrown() { getResourceContent("path/to/resource"); }
@Test public void givenPathToResource_whenGetResourceContentIsCalled_thenContentIsReturned() { assertEquals("This is a static resource file.", getResourceContent("eu/dnetlib/iis/common/data/@a/static-resource-file.txt")); }