DecisionTableVerifierWebWorkerProvider implements VerifierWebWorkerProvider { public String loadResource(final String name) throws Exception { final StringBuilder text = new StringBuilder(); try (final InputStream in = DecisionTableVerifierWebWorkerProvider.class.getResourceAsStream(name); final Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) { final char[] buf = new char[1024]; int len = 0; while ((len = reader.read(buf)) >= 0) { text.append(buf, 0, len); } } catch (final NullPointerException npe) { throw new FileNotFoundException("Could not find the verifier file " + name); } return text.toString(); }  @Override String getId(); @Override String getWebWorker(final String fileName); String loadResource(final String name);  }
@Test public void testLoad() throws Exception { assertEquals("hello there", new DecisionTableVerifierWebWorkerProvider().loadResource("test.txt")); }
@Test public void fileDoesNotExist() { final String filename = "doesNotExists.txt"; Assertions.assertThatThrownBy(() -> new DecisionTableVerifierWebWorkerProvider().loadResource(filename)) .hasMessage("Could not find the verifier file " + filename); }