@Test public void testLoadPropertiesFailure() { InputStream inputStream = new InputStream() { @Override public int read() throws IOException { throw new IOException(); } }; Properties props = Version.loadProperties(inputStream); assertEquals("0.0.0", props.getProperty("version")); assertEquals("2016-11-01 09:00:00", props.getProperty("build.time")); }
static Properties loadProperties(InputStream src) { Properties props = new Properties(); try { props.load(src); } catch (IOException e) { props.setProperty("version", "0.0.0"); props.setProperty("build.time", "2016-11-01 09:00:00"); } return props; }
Version { static Properties loadProperties(InputStream src) { Properties props = new Properties(); try { props.load(src); } catch (IOException e) { props.setProperty("version", "0.0.0"); props.setProperty("build.time", "2016-11-01 09:00:00"); } return props; } }
Version { static Properties loadProperties(InputStream src) { Properties props = new Properties(); try { props.load(src); } catch (IOException e) { props.setProperty("version", "0.0.0"); props.setProperty("build.time", "2016-11-01 09:00:00"); } return props; } @SuppressWarnings("WeakerAccess")  Version(); }
Version { static Properties loadProperties(InputStream src) { Properties props = new Properties(); try { props.load(src); } catch (IOException e) { props.setProperty("version", "0.0.0"); props.setProperty("build.time", "2016-11-01 09:00:00"); } return props; } @SuppressWarnings("WeakerAccess")  Version(); @SuppressWarnings("WeakerAccess") static String getVersion(); @SuppressWarnings("WeakerAccess") static String getBuildTime(); }
Version { static Properties loadProperties(InputStream src) { Properties props = new Properties(); try { props.load(src); } catch (IOException e) { props.setProperty("version", "0.0.0"); props.setProperty("build.time", "2016-11-01 09:00:00"); } return props; } @SuppressWarnings("WeakerAccess")  Version(); @SuppressWarnings("WeakerAccess") static String getVersion(); @SuppressWarnings("WeakerAccess") static String getBuildTime();  }