@Test public void getResourceAsUtf8String_ShouldThrowNotGonnaHappenException_WhenDeveloperFucksUpCodeOrPackaging() { assertThrows(NotGonnaHappenException.class, () -> cut.getResourceAsUtf8String("nonexistent")); }
String getResourceAsUtf8String(String name) { try (final InputStream stream = getClass().getClassLoader().getResourceAsStream(name)) { return IOUtils.toString(stream, StandardCharsets.UTF_8); } catch (IOException | NullPointerException e) { log.error("Cannot read demo resource file in classpath: {}", name, e); throw new NotGonnaHappenException("Demo file should exist and be valid in classpath: " + name); } }
DemoScenarioLoader { String getResourceAsUtf8String(String name) { try (final InputStream stream = getClass().getClassLoader().getResourceAsStream(name)) { return IOUtils.toString(stream, StandardCharsets.UTF_8); } catch (IOException | NullPointerException e) { log.error("Cannot read demo resource file in classpath: {}", name, e); throw new NotGonnaHappenException("Demo file should exist and be valid in classpath: " + name); } } }
DemoScenarioLoader { String getResourceAsUtf8String(String name) { try (final InputStream stream = getClass().getClassLoader().getResourceAsStream(name)) { return IOUtils.toString(stream, StandardCharsets.UTF_8); } catch (IOException | NullPointerException e) { log.error("Cannot read demo resource file in classpath: {}", name, e); throw new NotGonnaHappenException("Demo file should exist and be valid in classpath: " + name); } }  }
DemoScenarioLoader { String getResourceAsUtf8String(String name) { try (final InputStream stream = getClass().getClassLoader().getResourceAsStream(name)) { return IOUtils.toString(stream, StandardCharsets.UTF_8); } catch (IOException | NullPointerException e) { log.error("Cannot read demo resource file in classpath: {}", name, e); throw new NotGonnaHappenException("Demo file should exist and be valid in classpath: " + name); } }  void createScenarios(long projectId, Map<String, Long> functionalityIds); }
DemoScenarioLoader { String getResourceAsUtf8String(String name) { try (final InputStream stream = getClass().getClassLoader().getResourceAsStream(name)) { return IOUtils.toString(stream, StandardCharsets.UTF_8); } catch (IOException | NullPointerException e) { log.error("Cannot read demo resource file in classpath: {}", name, e); throw new NotGonnaHappenException("Demo file should exist and be valid in classpath: " + name); } }  void createScenarios(long projectId, Map<String, Long> functionalityIds);  }