@Test public void shouldNotAllowToOverwriteDefaultConfiguration() { TestRegistry testRegistry = new TestRegistry(); assertThatThrownBy(() -> testRegistry.addConfiguration("default", "test")) .isInstanceOf(IllegalArgumentException.class); }
@Override public void addConfiguration(String configName, C configuration) { if (configName.equals(DEFAULT_CONFIG)) { throw new IllegalArgumentException( "You cannot use 'default' as a configuration name as it is preserved for default configuration"); } this.configurations.put(configName, configuration); }
AbstractRegistry implements Registry<E, C> { @Override public void addConfiguration(String configName, C configuration) { if (configName.equals(DEFAULT_CONFIG)) { throw new IllegalArgumentException( "You cannot use 'default' as a configuration name as it is preserved for default configuration"); } this.configurations.put(configName, configuration); } }
AbstractRegistry implements Registry<E, C> { @Override public void addConfiguration(String configName, C configuration) { if (configName.equals(DEFAULT_CONFIG)) { throw new IllegalArgumentException( "You cannot use 'default' as a configuration name as it is preserved for default configuration"); } this.configurations.put(configName, configuration); } AbstractRegistry(C defaultConfig);  AbstractRegistry(C defaultConfig, Map<String, String> registryTags);  AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer);  AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer,
        Map<String, String> tags);  AbstractRegistry(C defaultConfig,
        List<RegistryEventConsumer<E>> registryEventConsumers);  AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers,
        Map<String, String> tags);  AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers,
                            Map<String, String> tags, RegistryStore<E> registryStore); }
AbstractRegistry implements Registry<E, C> { @Override public void addConfiguration(String configName, C configuration) { if (configName.equals(DEFAULT_CONFIG)) { throw new IllegalArgumentException( "You cannot use 'default' as a configuration name as it is preserved for default configuration"); } this.configurations.put(configName, configuration); } AbstractRegistry(C defaultConfig);  AbstractRegistry(C defaultConfig, Map<String, String> registryTags);  AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer);  AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer,
        Map<String, String> tags);  AbstractRegistry(C defaultConfig,
        List<RegistryEventConsumer<E>> registryEventConsumers);  AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers,
        Map<String, String> tags);  AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers,
                            Map<String, String> tags, RegistryStore<E> registryStore); @Override Optional<E> find(String name); @Override Optional<E> remove(String name); @Override Optional<E> replace(String name, E newEntry); @Override void addConfiguration(String configName, C configuration); @Override Optional<C> getConfiguration(String configName); @Override C getDefaultConfig(); @Override Map<String, String> getTags(); @Override EventPublisher<E> getEventPublisher(); }
AbstractRegistry implements Registry<E, C> { @Override public void addConfiguration(String configName, C configuration) { if (configName.equals(DEFAULT_CONFIG)) { throw new IllegalArgumentException( "You cannot use 'default' as a configuration name as it is preserved for default configuration"); } this.configurations.put(configName, configuration); } AbstractRegistry(C defaultConfig);  AbstractRegistry(C defaultConfig, Map<String, String> registryTags);  AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer);  AbstractRegistry(C defaultConfig, RegistryEventConsumer<E> registryEventConsumer,
        Map<String, String> tags);  AbstractRegistry(C defaultConfig,
        List<RegistryEventConsumer<E>> registryEventConsumers);  AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers,
        Map<String, String> tags);  AbstractRegistry(C defaultConfig, List<RegistryEventConsumer<E>> registryEventConsumers,
                            Map<String, String> tags, RegistryStore<E> registryStore); @Override Optional<E> find(String name); @Override Optional<E> remove(String name); @Override Optional<E> replace(String name, E newEntry); @Override void addConfiguration(String configName, C configuration); @Override Optional<C> getConfiguration(String configName); @Override C getDefaultConfig(); @Override Map<String, String> getTags(); @Override EventPublisher<E> getEventPublisher();  }