### Question:
ConfigurationProcessor { public <C> C process(Class<C> configurationClass) throws IllegalAccessException, InstantiationException { C configurationInstance = configurationClass.newInstance(); Field[] configurationProperties = configurationClass.getDeclaredFields(); for (Field configurationProperty : configurationProperties) { Configuration configuration = configurationProperty.getAnnotation(Configuration.class); if (configuration != null) { String sourceConfiguration = configurations.getProperty(configuration.value(), configuration.defaultValue()); if (sourceConfiguration != null && !Configuration.DEFAULT_VALUE.equals(sourceConfiguration)) { Class targetType = configurationProperty.getType(); Object parsedConfiguration = parseConfiguration(targetType, sourceConfiguration); if (parsedConfiguration != null) { setObjValue(configurationInstance, configurationProperty.getName(), parsedConfiguration); } } else { String msg = MessageFormat.format("No configuration found for ''{0}''", configuration.value()); LOGGER.warning(msg); } } } return configurationInstance; } ConfigurationProcessor(Properties configurations, Map<Class, ConfigurationParser> configurationParsers); C process(Class<C> configurationClass);  }### Answer:
@Test public void process() throws Exception { Class parserResponsibility = String.class; Properties properties = new Properties(); ConfigurationParser configurationParser = new ConfigurationParserDummyImpl(parserResponsibility); Map<Class, ConfigurationParser> configurationParserMap = new HashMap<>(); properties.put("test.exists", "MyCustomValue"); configurationParserMap.put(parserResponsibility, configurationParser); ConfigurationProcessor configurationProcessor = new ConfigurationProcessor(properties, configurationParserMap); ConfigDummyImpl cfg = configurationProcessor.process(ConfigDummyImpl.class); assertNotNull(cfg); assertEquals(cfg.getTestExists(), "MyCustomValue"); assertEquals(cfg.getTestWithDefault(), "defaultV"); assertEquals(cfg.getTestWithoutAnnotation(), "default"); assertEquals(cfg.getTestDoseNotExists(), null); }
@Test(expected = NoResponsibleParserFoundException.class) public void processNoMappingParserFound() throws Exception { Class parserResponsibility = Enum.class; Properties properties = new Properties(); ConfigurationParser configurationParser = new ConfigurationParserDummyImpl(parserResponsibility); Map<Class, ConfigurationParser> configurationParserMap = new HashMap<>(); properties.put("test.exists", "MyCustomValue"); configurationParserMap.put(parserResponsibility, configurationParser); ConfigurationProcessor configurationProcessor = new ConfigurationProcessor(properties, configurationParserMap); ConfigDummyImpl cfg = configurationProcessor.process(ConfigDummyImpl.class); assertNotNull(cfg); assertEquals(cfg.getTestExists(), "MyCustomValue"); assertEquals(cfg.getTestWithDefault(), "defaultV"); assertEquals(cfg.getTestWithoutAnnotation(), "default"); assertEquals(cfg.getTestDoseNotExists(), null); }