### Question:
WorkbenchPreferenceScopeTypes implements PreferenceScopeTypes { @Override public String getDefaultKeyFor(final String type) throws InvalidPreferenceScopeException { validateType(type); final DefaultKey defaultKey = defaultKeyByType.get(type); if (defaultKey == null) { throw new InvalidPreferenceScopeException("The type " + type + " does not have a default key."); } return defaultKey.get(); } protected  WorkbenchPreferenceScopeTypes(); @Inject  WorkbenchPreferenceScopeTypes(final UsernameProvider usernameProvider); @Override boolean typeRequiresKey(final String type); @Override String getDefaultKeyFor(final String type);  }### Answer:
@Test public void defaultKeysForTypesTest() { assertEquals(WorkbenchPreferenceScopes.GLOBAL, scopeTypes.getDefaultKeyFor(WorkbenchPreferenceScopes.GLOBAL)); assertEquals("admin", scopeTypes.getDefaultKeyFor(WorkbenchPreferenceScopes.USER)); }
@Test(expected = InvalidPreferenceScopeException.class) public void defaultKeyForProjectTest() { scopeTypes.getDefaultKeyFor(WorkbenchPreferenceScopes.PROJECT); }
@Test(expected = InvalidPreferenceScopeException.class) public void defaultKeyForSpaceTest() { scopeTypes.getDefaultKeyFor(WorkbenchPreferenceScopes.SPACE); }