@Test public void getProperties() { Properties properties = null; assertThat(properties, nullValue()); properties = PropFile.getProperties("/" + Resources.MAPS_P, true); assertThat(properties, notNullValue()); assertThat(properties.getProperty(Resources.MAP_ID), is(Resources.MAP_NAME)); assertThat(properties.getProperty(Resources.MAP_KEY), is(Resources.MAP_VALUE)); properties = PropFile.getProperties(FileUtil.getFile(Resources.MAPS_P).toString(), false); assertThat(properties, notNullValue()); assertThat(properties.getProperty(Resources.MAP_ID), is(Resources.MAP_NAME)); assertThat(properties.getProperty(Resources.MAP_KEY), is(Resources.MAP_VALUE)); }
public static final Properties getProperties(final String srcFile, final boolean internal) { Properties properties = new Properties(); try { if (internal) { properties.load(PropFile.class.getResourceAsStream(srcFile)); } else { properties.load(new FileInputStream(srcFile)); } return properties; } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } return null; }
PropFile { public static final Properties getProperties(final String srcFile, final boolean internal) { Properties properties = new Properties(); try { if (internal) { properties.load(PropFile.class.getResourceAsStream(srcFile)); } else { properties.load(new FileInputStream(srcFile)); } return properties; } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } return null; } }
PropFile { public static final Properties getProperties(final String srcFile, final boolean internal) { Properties properties = new Properties(); try { if (internal) { properties.load(PropFile.class.getResourceAsStream(srcFile)); } else { properties.load(new FileInputStream(srcFile)); } return properties; } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } return null; }  }
PropFile { public static final Properties getProperties(final String srcFile, final boolean internal) { Properties properties = new Properties(); try { if (internal) { properties.load(PropFile.class.getResourceAsStream(srcFile)); } else { properties.load(new FileInputStream(srcFile)); } return properties; } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } return null; }  static final Properties getProperties(final String srcFile, final boolean internal); static final String getProperty(final Properties properties, final String property); }
PropFile { public static final Properties getProperties(final String srcFile, final boolean internal) { Properties properties = new Properties(); try { if (internal) { properties.load(PropFile.class.getResourceAsStream(srcFile)); } else { properties.load(new FileInputStream(srcFile)); } return properties; } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } return null; }  static final Properties getProperties(final String srcFile, final boolean internal); static final String getProperty(final Properties properties, final String property);  }