@Test public void testStore() throws Exception { Preferences pref = mock( Preferences.class ); checkStoreMethod( pref ); }
public void store( final String configPath, final Configuration config ) throws ConfigStoreException { if ( ConfigFactory.isValidPath( configPath ) == false ) { throw new IllegalArgumentException( "The give path is not valid." ); } try { final Enumeration keys = config.getConfigProperties(); final Preferences pref = base.node( configPath ); pref.clear(); while ( keys.hasMoreElements() ) { final String key = (String) keys.nextElement(); final String value = config.getConfigProperty( key ); if ( value != null ) { pref.put( key, value ); } } pref.sync(); } catch ( BackingStoreException be ) { throw new ConfigStoreException( "Failed to store config" + configPath, be ); } }
Java14ConfigStorage implements ConfigStorage { public void store( final String configPath, final Configuration config ) throws ConfigStoreException { if ( ConfigFactory.isValidPath( configPath ) == false ) { throw new IllegalArgumentException( "The give path is not valid." ); } try { final Enumeration keys = config.getConfigProperties(); final Preferences pref = base.node( configPath ); pref.clear(); while ( keys.hasMoreElements() ) { final String key = (String) keys.nextElement(); final String value = config.getConfigProperty( key ); if ( value != null ) { pref.put( key, value ); } } pref.sync(); } catch ( BackingStoreException be ) { throw new ConfigStoreException( "Failed to store config" + configPath, be ); } } }
Java14ConfigStorage implements ConfigStorage { public void store( final String configPath, final Configuration config ) throws ConfigStoreException { if ( ConfigFactory.isValidPath( configPath ) == false ) { throw new IllegalArgumentException( "The give path is not valid." ); } try { final Enumeration keys = config.getConfigProperties(); final Preferences pref = base.node( configPath ); pref.clear(); while ( keys.hasMoreElements() ) { final String key = (String) keys.nextElement(); final String value = config.getConfigProperty( key ); if ( value != null ) { pref.put( key, value ); } } pref.sync(); } catch ( BackingStoreException be ) { throw new ConfigStoreException( "Failed to store config" + configPath, be ); } } Java14ConfigStorage( final Preferences base ); }
Java14ConfigStorage implements ConfigStorage { public void store( final String configPath, final Configuration config ) throws ConfigStoreException { if ( ConfigFactory.isValidPath( configPath ) == false ) { throw new IllegalArgumentException( "The give path is not valid." ); } try { final Enumeration keys = config.getConfigProperties(); final Preferences pref = base.node( configPath ); pref.clear(); while ( keys.hasMoreElements() ) { final String key = (String) keys.nextElement(); final String value = config.getConfigProperty( key ); if ( value != null ) { pref.put( key, value ); } } pref.sync(); } catch ( BackingStoreException be ) { throw new ConfigStoreException( "Failed to store config" + configPath, be ); } } Java14ConfigStorage( final Preferences base ); void store( final String configPath, final Configuration config ); Configuration load( final String configPath, final Configuration defaults ); boolean isAvailable( final String configPath ); }
Java14ConfigStorage implements ConfigStorage { public void store( final String configPath, final Configuration config ) throws ConfigStoreException { if ( ConfigFactory.isValidPath( configPath ) == false ) { throw new IllegalArgumentException( "The give path is not valid." ); } try { final Enumeration keys = config.getConfigProperties(); final Preferences pref = base.node( configPath ); pref.clear(); while ( keys.hasMoreElements() ) { final String key = (String) keys.nextElement(); final String value = config.getConfigProperty( key ); if ( value != null ) { pref.put( key, value ); } } pref.sync(); } catch ( BackingStoreException be ) { throw new ConfigStoreException( "Failed to store config" + configPath, be ); } } Java14ConfigStorage( final Preferences base ); void store( final String configPath, final Configuration config ); Configuration load( final String configPath, final Configuration defaults ); boolean isAvailable( final String configPath );  }