ClasspathResources { public static byte[] bytes(String path) { try (InputStream stream = stream(path)) { return stream.readAllBytes(); } catch (IOException e) { throw new UncheckedIOException(e); } }  static String text(String path); static byte[] bytes(String path); static InputStream stream(String path);  }
@Test void bytes() { assertThatThrownBy(() -> ClasspathResources.bytes("classpath-resource-test/not-existed-resource.properties")) .isInstanceOf(Error.class) .hasMessageContaining("can not load resource"); }