### Question:
ResourceHelper { public static Path getClasspathResource(Class<?> classDef, String classPathResource, String exceptionMessage) throws NoSuchFileException { try { return Paths.get(classDef.getResource(classPathResource).toURI()); } catch (FileSystemNotFoundException | URISyntaxException | NullPointerException e) { NoSuchFileException exc = new NoSuchFileException(classPathResource, null, exceptionMessage); exc.addSuppressed(e); throw exc; } }  static Path getClasspathResource(Class<?> classDef, String classPathResource, String exceptionMessage); static String getClasspathResourceAsStream(Class<?> classDef, String classPathResource);  }### Answer:
@Test public void testGetClasspathResource() throws Exception { Path classpathResource = ResourceHelper.getClasspathResource(this.getClass(), "classpath-resource.file", "no exception wanted!"); assertTrue(Files.exists(classpathResource)); assertEquals(FileUtils.readFileToString(classpathResource.toFile()), "test-file-content"); }
@Test(expectedExceptions = NoSuchFileException.class, expectedExceptionsMessageRegExp = "XX-resource.file: wanted Exception") public void testGetClasspathResourceException() throws Exception { ResourceHelper.getClasspathResource(this.getClass(), "XX-resource.file", "wanted Exception"); }