* Tests setConfigurations method
* @throws Exception to JUnit
*/
public void testSetConfigurations1() throws Exception {
List configurations = new ArrayList();
Configuration configuration4 = new Configuration();
configuration4.setName("n4");
configuration4.setValue("v4");
configuration4.setDescription("d4");
Configuration configuration5 = new Configuration();
configuration5.setName("n5");
configuration5.setValue("v5");
configuration5.setDescription("d5");
configurations.add(configuration4);
configurations.add(configuration5);
ConfigurationPersistenceImpl persistence = new ConfigurationPersistenceImpl();
persistence.setConfigurations(configurations, 1);
configurations = persistence.getConfigurations();
assertEquals("size is wrong", 5, configurations.size());
Set nameSet = new HashSet(Arrays.asList(new String[] {"n1", "n2", "n3", "n4", "n5"}));
Set valueSet = new HashSet(Arrays.asList(new String[] {"v1", "v2", "v3", "v4", "v5"}));
Set descSet = new HashSet(Arrays.asList(new String[] {"d1", "d2", "d3", "d4", "d5"}));
for (Iterator it = configurations.iterator(); it.hasNext();) {
Configuration configuration = (Configuration) it.next();
assertTrue("wrong name", nameSet.contains(configuration.getName()));
assertTrue("wrong value", valueSet.contains(configuration.getValue()));
assertTrue("wrong description", descSet.contains(configuration.getDescription()));
nameSet.remove(configuration.getName());
valueSet.remove(configuration.getValue());
descSet.remove(configuration.getDescription());
}
}