@Test public void testNonExistentPropertiesParsing() { Properties props = SpringBootUtil.getPropertiesResource(SpringBootUtilTest.class.getResource("/this-file-does-not-exist")); assertNotNull(props); assertEquals(0, props.size()); }
protected static Properties getPropertiesResource(URL resource) { Properties answer = new Properties(); if (resource != null) { try(InputStream stream = resource.openStream()) { answer.load(stream); } catch (IOException e) { throw new IllegalStateException("Error while reading resource from URL " + resource, e); } } return answer; }
SpringBootUtil { protected static Properties getPropertiesResource(URL resource) { Properties answer = new Properties(); if (resource != null) { try(InputStream stream = resource.openStream()) { answer.load(stream); } catch (IOException e) { throw new IllegalStateException("Error while reading resource from URL " + resource, e); } } return answer; } }
SpringBootUtil { protected static Properties getPropertiesResource(URL resource) { Properties answer = new Properties(); if (resource != null) { try(InputStream stream = resource.openStream()) { answer.load(stream); } catch (IOException e) { throw new IllegalStateException("Error while reading resource from URL " + resource, e); } } return answer; }  }
SpringBootUtil { protected static Properties getPropertiesResource(URL resource) { Properties answer = new Properties(); if (resource != null) { try(InputStream stream = resource.openStream()) { answer.load(stream); } catch (IOException e) { throw new IllegalStateException("Error while reading resource from URL " + resource, e); } } return answer; }  static Properties getSpringBootApplicationProperties(URLClassLoader compileClassLoader); static Optional<String> getSpringBootDevToolsVersion(MavenProject mavenProject); static Optional<String> getSpringBootVersion(MavenProject mavenProject); }
SpringBootUtil { protected static Properties getPropertiesResource(URL resource) { Properties answer = new Properties(); if (resource != null) { try(InputStream stream = resource.openStream()) { answer.load(stream); } catch (IOException e) { throw new IllegalStateException("Error while reading resource from URL " + resource, e); } } return answer; }  static Properties getSpringBootApplicationProperties(URLClassLoader compileClassLoader); static Optional<String> getSpringBootDevToolsVersion(MavenProject mavenProject); static Optional<String> getSpringBootVersion(MavenProject mavenProject);  }