ClasspathResourceResolver implements ResourceResolver { @Override public Reader reader(String name) { URL resource = ClasspathResourceResolver.class.getClassLoader().getResource(name); if (resource == null) { throw new LmRuntimeException("Extractor config not found in classpath: " + name); } try { return new InputStreamReader(resource.openStream(), StandardCharsets.UTF_8); } catch (IOException e) { throw new LmRuntimeException("Error reading classpath extractor config XML", e); } }  @Override Reader reader(String name);  }
@Test public void testReader_WithExtension() throws IOException { try (Reader r = loader.reader("com/nhl/link/move/resource/dummy.xml")) { assertNotNull(r); char[] buffer = new char[100]; int read = r.read(buffer, 0, buffer.length); assertEquals("<dummy/>", new String(buffer, 0, read)); } }
@Test public void testReader_Invalid() { assertThrows(LmRuntimeException.class, () -> loader.reader("no-such-resource.xml")); }