PropertyUtil { public double readDouble(String propName) { return Double.parseDouble(props.getProperty(propName)); } PropertyUtil(Properties props); int readInt(String propName); int readInt(String propName, int defaultValue); double readDouble(String propName); double readDouble(String propName, double defaultValue); boolean readBoolean(String propName); boolean readBoolean(String propName, boolean defaultValue); LocalTime readLocalTime(String propName); LocalTime readLocalTime( String propName, LocalTime defaultValue );  }
@Test public void testReadDouble() { testProperties.setProperty("myDoubleProp", "2.0"); assertEquals(2.0, testPropertyUtil.readDouble("myDoubleProp"),0); }
@Test public void testReadDouble_DefaultValueNotNeeded() { testProperties.setProperty("myDoubleProp", "2.0"); assertEquals(2.0, testPropertyUtil.readDouble("myDoubleProp", 3.0),0); }
@Test public void testReadDouble_DefaultValueNeeded() { assertEquals(3.0, testPropertyUtil.readDouble("myDoubleProp", 3.0),0); }