### Question:
GrinderProperties extends Properties { public final File resolveRelativeFile(File file) { if (m_file != null && file != null && !file.isAbsolute()) { return new File(m_file.getParentFile(), file.getPath()); } return file; } 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 testResolveRelativeFile() throws Exception { final File relativeDirectory = new File("d"); final File absoluteDirectory = relativeDirectory.getCanonicalFile(); final File absolute1 = new File(absoluteDirectory, "blah"); final File relative1 = new File("winterlong"); final File relative2 = new File(relative1, "i wait for you"); final GrinderProperties properties = new GrinderProperties(); assertNull(properties.resolveRelativeFile(null)); assertEquals(relative1, properties.resolveRelativeFile(relative1)); assertEquals(absolute1, properties.resolveRelativeFile(absolute1)); properties.setAssociatedFile(new File(relativeDirectory, "my.properties")); assertEquals(new File(relativeDirectory, relative1.getPath()), properties.resolveRelativeFile(relative1)); assertEquals(new File(relativeDirectory, relative2.getPath()), properties.resolveRelativeFile(relative2)); assertEquals(absolute1, properties.resolveRelativeFile(absolute1)); assertNull(properties.resolveRelativeFile(null)); properties.setAssociatedFile(new File(absoluteDirectory, "my.properties")); assertEquals(new File(absoluteDirectory, relative1.getPath()), properties.resolveRelativeFile(relative1)); assertEquals(new File(absoluteDirectory, relative2.getPath()), properties.resolveRelativeFile(relative2)); assertEquals(absolute1, properties.resolveRelativeFile(absolute1)); assertNull(properties.resolveRelativeFile(null)); }