### Question:
GrinderProperties extends Properties { public final double getDouble(String propertyName, double defaultValue) { final String s = getProperty(propertyName); if (s != null) { try { return Double.parseDouble(s.trim()); } catch (NumberFormatException e) { m_errorWriter.println("Warning, property '" + propertyName + "' does not specify a double value"); } } return defaultValue; } GrinderProperties();  GrinderProperties(File file); final File getAssociatedFile(); final void setAssociatedFile(File file); final void save(); final void saveSingleProperty(String name); final void setErrorWriter(PrintWriter writer); final synchronized GrinderProperties getPropertySubset(String prefix); final int getInt(String propertyName, int defaultValue); final void setInt(String propertyName, int value); final long getLong(String propertyName, long defaultValue); final void setLong(String propertyName, long value); final short getShort(String propertyName, short defaultValue); final void setShort(String propertyName, short value); final double getDouble(String propertyName, double defaultValue); final void setDouble(String propertyName, double value); final boolean getBoolean(String propertyName, boolean defaultValue); final void setBoolean(String propertyName, boolean value); final File getFile(String propertyName, File defaultValue); final File resolveRelativeFile(File file); final void setFile(String propertyName, File value); static final String SCRIPT; static final String LOG_DIRECTORY; static final String CONSOLE_HOST; static final String CONSOLE_PORT; static final File DEFAULT_PROPERTIES; static final File DEFAULT_SCRIPT; }### Answer:
@Test public void testGetDouble() throws Exception { assertEquals(1.0, m_grinderProperties.getDouble("Not there", 1.0), 0); (new IterateOverProperties(m_doubleSet) { void match(String key, String value) throws Exception { assertEquals(Double.parseDouble(value), m_grinderProperties.getDouble(key, 99.0), 0); } } ).run(); assertEquals(0, countErrorLines()); }
@Test public void testGetDoubleBroken() throws Exception { (new IterateOverProperties(m_brokenDoubleSet) { void match(String key, String value) { assertEquals(99.0, m_grinderProperties.getDouble(key, 99.0), 0); } } ).run(); assertEquals(m_brokenDoubleSet.size(), countErrorLines()); }