ConfigurationFactoryImpl implements ConfigurationFactory { @Override public SecureConfigItem newSecuredConfigItem(final String name, final String valueType) { final SecureConfigItem stringConfigItem = new SecureConfigItem(); if (name.startsWith(CRYPT_PREFIX)) { stringConfigItem.setName(name.substring(CRYPT_PREFIX.length())); } else { stringConfigItem.setName(name); } stringConfigItem.setValue(secureService.encrypt(valueType)); return stringConfigItem; } ConfigurationFactoryImpl(); @Inject  ConfigurationFactoryImpl(final PasswordService secureService); @Override ConfigGroup newConfigGroup(final ConfigType type,
                                      final String name,
                                      final String description); @Override ConfigGroup newConfigGroup(final ConfigType type,
                                      final String namespace,
                                      final String name,
                                      final String description); @Override ConfigItem<String> newConfigItem(final String name,
                                            final String valueType); @Override ConfigItem<Boolean> newConfigItem(final String name,
                                             final boolean valueType); @Override SecureConfigItem newSecuredConfigItem(final String name,
                                                 final String valueType); @Override ConfigItem<List> newConfigItem(String name,
                                          List valueType); @Override ConfigItem<Object> newConfigItem(String name,
                                            Object valueType);  }
@Test public void newSecuredConfigItemTest() { final SecureConfigItem securedConfigItem = configurationFactory.newSecuredConfigItem("my-item", "my-password"); assertEquals("my-item", securedConfigItem.getName()); assertEquals("my-password", passwordService.decrypt(securedConfigItem.getValue())); }