DefaultPreferenceScopeTypes implements PreferenceScopeTypes { @Override public boolean typeRequiresKey(final String type) throws InvalidPreferenceScopeException { validateType(type); return defaultKeyByType.get(type) == null; } protected  DefaultPreferenceScopeTypes(); @Inject  DefaultPreferenceScopeTypes(final UsernameProvider usernameProvider); @Override boolean typeRequiresKey(final String type); @Override String getDefaultKeyFor(final String type);  }
@Test public void typesRequireKeyTest() { assertFalse(defaultPreferenceScopeTypes.typeRequiresKey(DefaultScopes.ALL_USERS.type())); assertFalse(defaultPreferenceScopeTypes.typeRequiresKey(DefaultScopes.ENTIRE_APPLICATION.type())); assertTrue(defaultPreferenceScopeTypes.typeRequiresKey(DefaultScopes.COMPONENT.type())); assertFalse(defaultPreferenceScopeTypes.typeRequiresKey(DefaultScopes.USER.type())); }