public static String readClasspathResource(Class<?> relativeTo, String resourcePath) {
    try {
      InputStream resourceStream = relativeTo.getResourceAsStream(resourcePath);
      if (resourceStream == null) {
        throw new IllegalStateException(getErrorMessage(relativeTo, resourcePath));
      }
      return IOUtils.toString(resourceStream, StandardCharsets.UTF_8);
    } catch (IOException e) {
      throw new IllegalStateException(getErrorMessage(relativeTo, resourcePath), e);
    }
  }
@Test
  public void whenReadValidClasspathResource_thenReadIt() {
    String result = ResourceUtils.readClasspathResource(ResourceUtilsTest.class, "classpath_resource.txt");
    assertThat(result)
      .isEqualTo("OK\n");
  }