PreferenceScopeFactoryImpl implements PreferenceScopeFactory { @Override public PreferenceScope cloneScope(final PreferenceScope scope) { if (scope == null) { return null; } return new PreferenceScopeImpl(scope.type(), scope.key(), cloneScope(scope.childScope())); } protected  PreferenceScopeFactoryImpl(); @Inject  PreferenceScopeFactoryImpl(@Customizable final PreferenceScopeTypes scopeTypes); @Override PreferenceScope createScope(final String type); @Override PreferenceScope createScope(final String type,
                                       final PreferenceScope childScope); @Override PreferenceScope createScope(final String type,
                                       final String key); @Override PreferenceScope createScope(final String type,
                                       final String key,
                                       final PreferenceScope childScope); @Override PreferenceScope createScope(final PreferenceScope... scopes); @Override PreferenceScope cloneScope(final PreferenceScope scope);  }
@Test public void cloneScopeTest() { PreferenceScope scope = scopeFactory.createScope(userScope, entireApplicationScope); PreferenceScope newScope = scopeFactory.cloneScope(scope); assertTrue(scope != newScope); assertEquals(scope, newScope); }