@Test(expected = FileNotFoundException.class) public void testGetResourcesStreamNotFoundNull() throws FileNotFoundException { PropertiesUtils.getResourceAsStream(null); fail(ResourcesPublicUtilTest.EXPECTING_EXCEPTION_FILE_NOT_FOUND_EXCEPTION); }
public static InputStream getResourceAsStream(String resourcesFile) throws FileNotFoundException { if (resourcesFile == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES); } InputStream stream = null; try { stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } if (stream == null) { try { stream = PropertiesUtils.class.getClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } } if (stream == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile); } return stream; }
PropertiesUtils { public static InputStream getResourceAsStream(String resourcesFile) throws FileNotFoundException { if (resourcesFile == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES); } InputStream stream = null; try { stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } if (stream == null) { try { stream = PropertiesUtils.class.getClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } } if (stream == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile); } return stream; } }
PropertiesUtils { public static InputStream getResourceAsStream(String resourcesFile) throws FileNotFoundException { if (resourcesFile == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES); } InputStream stream = null; try { stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } if (stream == null) { try { stream = PropertiesUtils.class.getClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } } if (stream == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile); } return stream; } private  PropertiesUtils(); }
PropertiesUtils { public static InputStream getResourceAsStream(String resourcesFile) throws FileNotFoundException { if (resourcesFile == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES); } InputStream stream = null; try { stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } if (stream == null) { try { stream = PropertiesUtils.class.getClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } } if (stream == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile); } return stream; } private  PropertiesUtils(); static InputStream getConfigAsStream(String resourcesFile); static InputStream getResourceAsStream(String resourcesFile); static File getResourceFile(String resourcesFile); static Path getResourcePath(String resourcesFile); static Stream<String> getResourceListing(Class clazz, String path); static File findFile(String filename); static File fileFromConfigFolder(String subpath); static File fileFromDataFolder(String subpath); static File fileFromTmpFolder(String subpath); static Properties readProperties(File propertiesFile); static C readYaml(File yamlFile, Class<C> clasz); static C readYaml(File yamlFile, TypeReference<C> typeReference); static C readYaml(InputStream yamlInputStream, Class<C> clasz); static C readYaml(Path yamlPath, Class<C> clasz); static void writeYaml(File destination, Object config); static String getResourceAsString(String resourcesFile); }
PropertiesUtils { public static InputStream getResourceAsStream(String resourcesFile) throws FileNotFoundException { if (resourcesFile == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES); } InputStream stream = null; try { stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } if (stream == null) { try { stream = PropertiesUtils.class.getClassLoader().getResourceAsStream(resourcesFile); } catch (final SecurityException e) { SysErrLogger.FAKE_LOGGER.ignoreLog(e); } } if (stream == null) { throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile); } return stream; } private  PropertiesUtils(); static InputStream getConfigAsStream(String resourcesFile); static InputStream getResourceAsStream(String resourcesFile); static File getResourceFile(String resourcesFile); static Path getResourcePath(String resourcesFile); static Stream<String> getResourceListing(Class clazz, String path); static File findFile(String filename); static File fileFromConfigFolder(String subpath); static File fileFromDataFolder(String subpath); static File fileFromTmpFolder(String subpath); static Properties readProperties(File propertiesFile); static C readYaml(File yamlFile, Class<C> clasz); static C readYaml(File yamlFile, TypeReference<C> typeReference); static C readYaml(InputStream yamlInputStream, Class<C> clasz); static C readYaml(Path yamlPath, Class<C> clasz); static void writeYaml(File destination, Object config); static String getResourceAsString(String resourcesFile);  }