### Question:
PropertiesFileConverter implements ValueConverter<Map<String, String>> { @Override public Map<String, String> convert( String value ) { Properties properties = new Properties(); try { properties.load( new FileInputStream( new File( value ) ) ); Map<String, String> values = Maps.newHashMap(); for( String key : properties.stringPropertyNames() ) values.put( key, properties.getProperty( key ) ); return values; } catch( IOException ioe ) { throw new IllegalArgumentException( "problem while reading properties file " + value, ioe ); } }  @Override Map<String, String> convert( String value ); @Override Class<Map<String, String>> valueType(); @Override String valuePattern();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testConvertWithNonExistentFile() { PropertiesFileConverter pfc = new PropertiesFileConverter(); pfc.convert( "/does/not/exist" ); }
@Test public void testConvert() throws IOException { File propsFile = File.createTempFile( "lingual.test.properties", null ); propsFile.deleteOnExit(); Properties testProps = new Properties(); testProps.setProperty( "test1", "some value" ); testProps.setProperty( "test2", "some other value" ); testProps.store( new FileOutputStream( propsFile ), "" ); PropertiesFileConverter pfc = new PropertiesFileConverter(); Map<String, String> result = pfc.convert( propsFile.getAbsolutePath() ); Map<String, String> expected = Maps.newHashMap(); expected.put( "test1", "some value" ); expected.put( "test2", "some other value" ); assertEquals( expected, result ); }