@Test @DisplayName("Survives unreadable properties file on classpath") void testClasspathConfigUnreadable() throws Exception { Assumptions.assumeTrue(SUPPORTS_POSIX, "File system does not support Posix"); String pathPrefix = this.getClass().getName().replace('.', '/') + "/testClasspathConfigUnreadable/"; ClassLoader original = Thread.currentThread().getContextClassLoader(); Path path = Paths.get(original.getResource(pathPrefix + "business-parameters.properties").toURI()); Set<PosixFilePermission> originalPermissions = Files.getPosixFilePermissions(path); try { Files.setPosixFilePermissions(path, PosixFilePermissions.fromString("---------")); UnaryOperator<String> rewrite = resource -> pathPrefix + resource; Thread.currentThread().setContextClassLoader(rewriteResourceLoader(original, rewrite)); Configuration config = new ServerConfigurationProvider().getConfiguration(); assertThat(config.getStringParameter("property")).isNotPresent(); } finally { Thread.currentThread().setContextClassLoader(original); Files.setPosixFilePermissions(path, originalPermissions); } }
@Override public Configuration getConfiguration() { return ensureLoadedConfiguration(); }
ServerConfigurationProvider implements ConfigurationProvider { @Override public Configuration getConfiguration() { return ensureLoadedConfiguration(); } }
ServerConfigurationProvider implements ConfigurationProvider { @Override public Configuration getConfiguration() { return ensureLoadedConfiguration(); }  }
ServerConfigurationProvider implements ConfigurationProvider { @Override public Configuration getConfiguration() { return ensureLoadedConfiguration(); }  @Override Configuration getConfiguration(); }
ServerConfigurationProvider implements ConfigurationProvider { @Override public Configuration getConfiguration() { return ensureLoadedConfiguration(); }  @Override Configuration getConfiguration();  }