ResourceUtil { public static ResourceFile getResourceAsFile(final String path) { return new ResourceFile(path); } private  ResourceUtil(); static String readResourceFileToString(final String path); static List<String> readResourceFileToStringList(final String path); static List<String> readResourceFileToStringList(final ResourceFile resourceFile); static ResourceFile getResourceAsFile(final String path); static URL getResourceAsURL(final String path); static String getResourceAsTempFile(final String resourcePath);  }
@Test public void testGetResourceAsFile() { File resourceFile = ResourceUtil.getResourceAsFile(RESOURCE_FILE_PATH); assertTrue("The file returned for the resource path does not exist", resourceFile.exists()); assertTrue("The file returned is not a file but a directory.", !resourceFile.isDirectory()); }
@Test public void test() throws IOException { ResourceFile resFile = ResourceUtil.getResourceAsFile(RESOURCE_FILE_PATH); ResourceFile res2File = new ResourceFile(resFile.getParentFile(), "dummy2.resource"); assertEquals(this.readRes(resFile.getPathName()), this.readRes(res2File.getPathName())); }