### Question:
CommentedProperties extends Properties { @Override public synchronized void store( OutputStream out, String comments ) throws IOException { byte[] bytes = m_propertyString.getBytes("ISO-8859-1"); FileUtil.copyContents( new ByteArrayInputStream( bytes ), out ); out.flush(); } CommentedProperties();  CommentedProperties( Properties defaultValues ); @Override synchronized void load( InputStream inStream ); @Override synchronized void load( Reader in ); @Override synchronized Object setProperty( String key, String value ); @Override synchronized void store( OutputStream out, String comments ); @Override synchronized Object put( Object arg0, Object arg1 ); @Override synchronized void putAll( Map< ? , ? > arg0 ); @Override synchronized Object remove( Object key ); @Override synchronized String toString();  }### Answer:
@Test public void testStore() throws Exception { File outFile = createFile( "test2.properties" ); OutputStream out = new FileOutputStream( outFile ); m_props.store( out, null ); out.close(); Properties props2 = new CommentedProperties(); InputStream in = CommentedPropertiesTest.class.getClassLoader().getResourceAsStream( "test2.properties" ); props2.load( in ); in.close(); Assertions.assertEquals( m_props.toString(), props2.toString() ); m_props.remove( "testProp1" ); m_props.remove( "testProp2" ); m_props.remove( "testProp3" ); outFile = createFile( "test3.properties" ); out = new FileOutputStream( outFile ); m_props.store( out, null ); out.close(); Properties props3 = new CommentedProperties(); in = CommentedPropertiesTest.class.getClassLoader().getResourceAsStream( "test3.properties" ); props3.load( in ); in.close(); Assertions.assertNotSame( m_props.toString(), props3.toString() ); Assertions.assertFalse( props3.containsKey( "testProp1" ) ); Assertions.assertFalse( props3.containsKey( "testProp2" ) ); Assertions.assertFalse( props3.containsKey( "testProp3" ) ); Assertions.assertTrue( props3.containsKey( "testProp4" ) ); Assertions.assertTrue( props3.containsKey( "testProp5" ) ); File file = getFile( "test2.properties" ); if ( file != null && file.exists() ) { file.delete(); } file = getFile( "test3.properties" ); if ( file != null && file.exists() ) { file.delete(); } }