RoutingProcessorConfigurationParser { public RoutingProcessorConfiguration parseConfiguration(HierarchicalConfiguration config) throws ConfigurationException { RoutingProcessorConfigurationImpl result = new RoutingProcessorConfigurationImpl(); Set<String> instanceKeys = new HashSet<String>(); for(HierarchicalConfiguration subConfig : config.configurationsAt("RoutingInstance")) { RoutingInstanceConfiguration instance = instanceParser.parseConfiguration(subConfig); String key = instance.getFirstPeer().getPeerName() + "/" + instance.getSecondPeer().getPeerName(); if(instanceKeys.contains(key)) throw new ConfigurationException("Duplicate confugration, first: " + instance.getFirstPeer().getPeerName() + ", second: " + instance.getSecondPeer().getPeerName()); result.getRoutingInstances().add(instance); instanceKeys.add(key); } return result; }  RoutingProcessorConfiguration parseConfiguration(HierarchicalConfiguration config);  }
@Test public void testOneEntry() throws Exception { RoutingProcessorConfiguration prc = parser.parseConfiguration(config.configurationAt("RoutingProcessor(0)")); Assert.assertEquals(2, prc.getRoutingInstances().size()); Assert.assertTrue(prc.getRoutingInstances().contains(firstInstance)); Assert.assertTrue(prc.getRoutingInstances().contains(secondInstance)); }