UniqueIdSchemeDelegator { public boolean registerDelegate(final String scheme, final T delegate) { ArgumentChecker.notNull(scheme, "scheme"); ArgumentChecker.notNull(delegate, "delegate"); return _schemeToDelegateMap.putIfAbsent(scheme, delegate) == null; } UniqueIdSchemeDelegator(final T defaultDelegate);  UniqueIdSchemeDelegator(final T defaultDelegate, final Map<String, T> schemePrefixToDelegateMap); T getDefaultDelegate(); Map<String, T> getDelegates(); Iterable<T> getAllDelegates(); T chooseDelegate(final String scheme); boolean registerDelegate(final String scheme, final T delegate); void removeDelegate(final String scheme);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_registerDelegate_nullScheme() { UniqueIdSchemeDelegator<String> test = new UniqueIdSchemeDelegator<String>("default"); test.registerDelegate(null, "default"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_registerDelegate_nullDelegate() { UniqueIdSchemeDelegator<String> test = new UniqueIdSchemeDelegator<String>("default"); test.registerDelegate("default", null); }