ModulesYamlConfigLoader implements ModulesConfigLoader { @Override public String loadString(String moduleName, String property) { JsonNode propertyNode = loadPropertyNode(moduleName, property); if (propertyNode == null || propertyNode.isNull()) { throw new ModulePropertyNotFoundException(moduleName, property); } return propertyNode.asText(); } ModulesYamlConfigLoader();  ModulesYamlConfigLoader(String modulesDirPath); @Override String loadString(String moduleName, String property); @Override String loadStringOrDefault(String moduleName, String property, String defaultValue); @Override Integer loadInteger(String moduleName, String property); @Override Integer loadIntegerOrDefault(String moduleName, String property, Integer defaultValue); @Override List<String> loadStringList(String moduleName, String property); @Override List<String> loadStringListOrDefault(String moduleName, String property, List<String> defaultValue); @Override List<Integer> loadIntegerList(String moduleName, String property); @Override List<Integer> loadIntegerListOrDefault(String moduleName, String property, List<Integer> defaultValue);  }
@Test public void testLoadStringProperty() { String value = loader.loadString(CONFIG_FILE, "string"); assertThat(value).isEqualTo("John Doe"); }
@Test public void testLoadNullStringThrowsError() { assertThatExceptionOfType(ModulePropertyNotFoundException.class) .isThrownBy(() -> loader.loadString(CONFIG_FILE, NULL_PROPERTY)); }